Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--libcurl: problem with output of non-printable characters was fixed #469

wants to merge 1 commit into from


Copy link

@majstar majstar commented Oct 2, 2015

I have found a little problem with output of non-printable characters when --libcurl option is used.
For example, we are trying to post contents of binfile.bin file with non-printable characters inside:

~> cat binfile.bin

~> curl --libcurl ~/result.c --request POST --data-binary "@binfile.bin"
some cURL output

~> cat result.c
// skip a few lines
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "\02");

As you can see, the content of binfile.bin file was not copied correctly to the generated C source file.
The problem occurs because snprintf function reserves space for the additional terminating null character. The fix is provided in 9414a9e commit.

@jay jay closed this in 2eb4f5e Oct 2, 2015
Copy link

jay commented Oct 2, 2015

Thanks, that was a bug. Your fix landed in 2eb4f5e. If your binary data has null bytes truncation will still occur in the source generation when --libcurl because we treat the postdata as a string. I'll open an issue to address that soon.

jgsogo pushed a commit to jgsogo/curl that referenced this pull request Oct 19, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants