mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 13:56:01 +03:00
Adds a graceful error if there is no memory for request body inspection
Issue #1517
This commit is contained in:
parent
9a41942ce1
commit
b36c4260c1
@ -838,7 +838,12 @@ int Transaction::requestBodyFromFile(const char *path) {
|
||||
}
|
||||
|
||||
request_body.seekg(0, std::ios::end);
|
||||
str.reserve(request_body.tellg());
|
||||
try {
|
||||
str.reserve(request_body.tellg());
|
||||
} catch (...) {
|
||||
debug(3, "Failed to allocate memory to load request body.");
|
||||
return false;
|
||||
}
|
||||
request_body.seekg(0, std::ios::beg);
|
||||
str.assign((std::istreambuf_iterator<char>(request_body)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
Loading…
x
Reference in New Issue
Block a user