1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-07-08 08:21:55 +03:00

Merge pull request #176 from arduino-libraries/iContentLength_wraparound

Make sure iContentLength doesn't wrap around due to malformed packets
This commit is contained in:
Martino Facchin
2024-07-25 12:03:49 +02:00
committed by GitHub

View File

@ -819,7 +819,11 @@ int HttpClient::readHeader()
case eReadingContentLength:
if (isdigit(c))
{
iContentLength = iContentLength*10 + (c - '0');
long _iContentLength = iContentLength*10 + (c - '0');
// Only apply if the value didn't wrap around
if (_iContentLength > iContentLength) {
iContentLength = _iContentLength;
}
}
else
{