mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
sendf: fix CR detection if no LF is in the chunk
When doing line ending conversions, and a chunk contains no '\n', the function returned early without updating prev_cr to reflect the last byte. It could then lead to CRLFs sequences not get converted when occuring right on the boundary border. Found by Codex Security Closes #21221
This commit is contained in:
parent
ec22ea2502
commit
2e5d219205
@ -1009,6 +1009,8 @@ static CURLcode cr_lc_read(struct Curl_easy *data,
|
|||||||
|
|
||||||
if(!nread || !memchr(buf, '\n', nread)) {
|
if(!nread || !memchr(buf, '\n', nread)) {
|
||||||
/* nothing to convert, return this right away */
|
/* nothing to convert, return this right away */
|
||||||
|
if(nread)
|
||||||
|
ctx->prev_cr = (buf[nread - 1] == '\r');
|
||||||
if(ctx->read_eos)
|
if(ctx->read_eos)
|
||||||
ctx->eos = TRUE;
|
ctx->eos = TRUE;
|
||||||
*pnread = nread;
|
*pnread = nread;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user