mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-26 20:48:24 +00:00
Fail to read a chunk if its length is >= ULONG_MAX (#444)
We cannot trivially support such large chunks, and the maximum value std::strtoul can parse accurately is ULONG_MAX-1. Error out early if the length is longer than that.
This commit is contained in:
1 parent
c49441ae64
commit
df138366e4
2 files changed
+15
No files matched your search
@@ -1900,6 +1900,7 @@ inline bool read_content_chunked(Stream &strm, ContentReceiver out) {
|
||||
chunk_len = std::strtoul(line_reader.ptr(), &end_ptr, 16);
|
||||
|
||||
if (end_ptr == line_reader.ptr()) { return false; }
|
||||
if (chunk_len == ULONG_MAX) { return false; }
|
||||
|
||||
if (chunk_len == 0) { break; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user