Merge commit from fork

Check header table bounds
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2026-11-09 09:56:57 -03:00
commit 9d6d064b39
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;
}