Check header table bounds

This commit is contained in:
robert committed 2026-08-21 15:07:11 +03:00
1 parent 53d2356472
commit 07e580d956
3 files changed
+25 -2

No files matched your search

+6
View File
@@ -265,6 +265,12 @@ static bool mg_http_parse_headers(const char *s, const char *end,
// MG_INFO(("--HH [%.*s] [%.*s]", (int) k.len, k.buf, (int) v.len, v.buf));
h[i].name = k, h[i].value = v; // Success. Assign values
}
if (i == max_hdrs &&
!(s < end &&
(s[0] == '\n' ||
(s[0] == '\r' && s + 1 < end && s[1] == '\n')))) {
return false;
}
return true;
}