mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 08:31:43 +02:00
fix a potential DoS vulnerability by restricting the length of the HTTP chunk size in chunked transfer encoding
This commit is contained in:
@@ -67,7 +67,8 @@ int HTTPChunkedStreamBuf::readFromDevice(char* buffer, std::streamsize length)
|
|||||||
int ch = _session.get();
|
int ch = _session.get();
|
||||||
while (Poco::Ascii::isSpace(ch)) ch = _session.get();
|
while (Poco::Ascii::isSpace(ch)) ch = _session.get();
|
||||||
std::string chunkLen;
|
std::string chunkLen;
|
||||||
while (Poco::Ascii::isHexDigit(ch)) { chunkLen += (char) ch; ch = _session.get(); }
|
while (Poco::Ascii::isHexDigit(ch) && chunkLen.size() < 8) { chunkLen += (char) ch; ch = _session.get(); }
|
||||||
|
if (ch != eof && !(Poco::Ascii::isSpace(ch) || ch == ';')) return eof;
|
||||||
while (ch != eof && ch != '\n') ch = _session.get();
|
while (ch != eof && ch != '\n') ch = _session.get();
|
||||||
unsigned chunk;
|
unsigned chunk;
|
||||||
if (NumberParser::tryParseHex(chunkLen, chunk))
|
if (NumberParser::tryParseHex(chunkLen, chunk))
|
||||||
|
Reference in New Issue
Block a user