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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user