mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +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();
|
||||
while (Poco::Ascii::isSpace(ch)) ch = _session.get();
|
||||
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();
|
||||
unsigned chunk;
|
||||
if (NumberParser::tryParseHex(chunkLen, chunk))
|
||||
|
Reference in New Issue
Block a user