Browse Source

check for chunk size

pull/437/head
orignal 9 years ago
parent
commit
bc5ff37e37
  1. 8
      util.cpp

8
util.cpp

@ -106,11 +106,15 @@ namespace http
while (!response.eof ()) while (!response.eof ())
{ {
std::string hexLen; std::string hexLen;
int len; size_t len;
std::getline (response, hexLen); std::getline (response, hexLen);
std::istringstream iss (hexLen); std::istringstream iss (hexLen);
iss >> std::hex >> len; iss >> std::hex >> len;
if (!len) break; if (!len || len > 10000000L) // 10M
{
LogPrint (eLogError, "Unexpected chunk length ", len);
break;
}
char * buf = new char[len]; char * buf = new char[len];
response.read (buf, len); response.read (buf, len);
merged.write (buf, len); merged.write (buf, len);

Loading…
Cancel
Save