fail on a truncated chunk instead of returning uninitialized bytes

This commit is contained in:
PobreGato
2026-08-31 03:00:47 +03:00
parent 8dad408660
commit 954e98eb4d
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -616,6 +616,11 @@ namespace http
return false; /* too large chunk */
char * buf = new char[len];
in.read (buf, len);
if (in.gcount () != len) /* chunk is shorter than announced */
{
delete[] buf;
return false;
}
out.write (buf, len);
delete[] buf;
std::getline (in, hexLen); // read \r\n after chunk