Skip to content

Commit 8a02474

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 9ed7c0d commit 8a02474

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/WebRequest.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,12 @@ bool AsyncWebServerRequest::_parseReqHeader() {
562562
bvlen--;
563563
// Reserve at most 70 chars — the RFC 2046 §5.1 maximum — rather than
564564
// the full (attacker-controlled) remaining suffix length.
565-
_boundary.reserve(70);
565+
if (!_boundary.reserve(70)) {
566+
async_ws_log_e("Failed to allocate");
567+
_parseState = PARSE_REQ_FAIL;
568+
abort();
569+
return true;
570+
}
566571
bool closed = false;
567572
for (size_t i = 0; i < bvlen; ++i) {
568573
char c = bvdata[i];

0 commit comments

Comments
 (0)