http: error on OOM when creating range header

Closes #19630
This commit is contained in:
Daniel Stenberg 2025-11-20 18:06:37 +01:00
parent ad9b12d411
commit 01623e26d0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2538,6 +2538,8 @@ static CURLcode http_range(struct Curl_easy *data,
free(data->state.aptr.rangeline);
data->state.aptr.rangeline = curl_maprintf("Range: bytes=%s\r\n",
data->state.range);
if(!data->state.aptr.rangeline)
return CURLE_OUT_OF_MEMORY;
}
else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
!Curl_checkheaders(data, STRCONST("Content-Range"))) {