Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25f54e9

Browse files
Merge pull request #176 from arduino-libraries/iContentLength_wraparound
Make sure iContentLength doesn't wrap around due to malformed packets
2 parents 6f2659d + 1a3fb98 commit 25f54e9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/HttpClient.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,11 @@ int HttpClient::readHeader()
819819
case eReadingContentLength:
820820
if (isdigit(c))
821821
{
822-
iContentLength = iContentLength*10 + (c - '0');
822+
long _iContentLength = iContentLength*10 + (c - '0');
823+
// Only apply if the value didn't wrap around
824+
if (_iContentLength > iContentLength) {
825+
iContentLength = _iContentLength;
826+
}
823827
}
824828
else
825829
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /