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

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@majstar
Contributor
majstar commented Oct 2, 2015

Hello.
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" http://tut.by
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.

@majstar majstar --libcurl: problem with output of non-printable characters was fixed
9414a9e
@jay jay added a commit that closed this pull request Oct 2, 2015
@majstar @jay majstar + jay tool_setopt: fix c_escape truncated octal
Closes #469
2eb4f5e
@jay jay closed this in 2eb4f5e Oct 2, 2015
@jay
Member
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 jgsogo added a commit to jgsogo/curl that referenced this pull request Oct 19, 2015
@majstar @jgsogo majstar + jgsogo tool_setopt: fix c_escape truncated octal
Closes curl#469
6e465d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment