From: Daniel Stenberg Date: Thu, 27 Feb 2025 22:12:01 +0000 (+0100) Subject: http_chunks: replace a strofft call with curl_str_hex X-Git-Tag: curl-8_13_0~290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=324b439634ea98a2fa2207d5291a44bccf6b7730;p=thirdparty%2Fcurl.git http_chunks: replace a strofft call with curl_str_hex Make it not skip leading blanks. There should not be any. Closes #16546 --- diff --git a/lib/http_chunks.c b/lib/http_chunks.c index aea84be986..b198577940 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -34,7 +34,7 @@ #include "content_encoding.h" #include "http.h" #include "multiif.h" -#include "strtoofft.h" +#include "strparse.h" #include "warnless.h" /* The last #include files should be: */ @@ -158,6 +158,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data, (*pconsumed)++; } else { + const char *p; if(0 == ch->hexindex) { /* This is illegal data, we received junk where we expected a hexadecimal digit. */ @@ -166,11 +167,11 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data, ch->last_code = CHUNKE_ILLEGAL_HEX; return CURLE_RECV_ERROR; } - /* blen and buf are unmodified */ ch->hexbuffer[ch->hexindex] = 0; - if(curlx_strtoofft(ch->hexbuffer, NULL, 16, &ch->datasize)) { - failf(data, "chunk hex-length not valid: '%s'", ch->hexbuffer); + p = &ch->hexbuffer[0]; + if(Curl_str_hex(&p, &ch->datasize, CURL_OFF_T_MAX)) { + failf(data, "invalid chunk size: '%s'", ch->hexbuffer); ch->state = CHUNK_FAILED; ch->last_code = CHUNKE_ILLEGAL_HEX; return CURLE_RECV_ERROR;