From: Daniel Stenberg Date: Sun, 29 May 2005 22:30:48 +0000 (+0000) Subject: Eric Cooper reported about a problem with HTTP servers that responds with X-Git-Tag: upstream/7.37.1~11088 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7846189cdb09a9d7ecca43f045cd0fb4517fe39;p=platform%2Fupstream%2Fcurl.git Eric Cooper reported about a problem with HTTP servers that responds with binary zeroes within the headers. They confused libcurl to do wrong so the downloaded headers become incomplete. The fix is now verified with test case 262. --- diff --git a/CHANGES b/CHANGES index b8ea14d..1095971 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,12 @@ Changelog +Daniel (30 May 2005) +- Eric Cooper reported about a problem with HTTP servers that responds with + binary zeroes within the headers. They confused libcurl to do wrong so the + downloaded headers become incomplete. The fix is now verified with test case + 262. + Daniel (24 May 2005) - Andres Garcia provided a text mode patch for several test cases so that they do text comparisions better on Windows (newline-wise). diff --git a/lib/transfer.c b/lib/transfer.c index 3c1b52a..fdc825b 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -360,7 +360,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, /* str_start is start of line within buf */ k->str_start = k->str; - k->end_ptr = strchr (k->str_start, '\n'); + k->end_ptr = memchr(k->str_start, '\n', nread); if (!k->end_ptr) { /* Not a complete header line within buffer, append the data to @@ -428,7 +428,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, } /* copy to end of line */ - strncpy (k->hbufp, k->str_start, full_length); + memcpy(k->hbufp, k->str_start, full_length); k->hbufp += full_length; k->hbuflen += full_length; *k->hbufp = 0; diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 8d64cf8..50ef1ec 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -32,4 +32,4 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test231 test232 test228 test229 test233 test234 test235 test236 test520 \ test237 test238 test239 test243 test245 test246 test247 test248 test249 \ test250 test251 test252 test253 test254 test255 test521 test522 test523 \ - test256 test257 test258 test259 test260 test261 + test256 test257 test258 test259 test260 test261 test262 diff --git a/tests/data/test262 b/tests/data/test262 new file mode 100644 index 0000000..b9b5a61 Binary files /dev/null and b/tests/data/test262 differ