mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
BUG/MINOR: compression: Add OOM check for calloc() in parse_compression_options()
This patch adds a missing out-of-memory (OOM) check after the call to `calloc()` in `parse_compression_options()`. If memory allocation fails, an error message is set, the function returns -1, and parsing is aborted to ensure safe handling of low-memory conditions. Co-authored-by: Christian Norbert Menges <christian.norbert.menges@sap.com>
This commit is contained in:
parent
73f9a75894
commit
aa20905ac9
@ -830,6 +830,11 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
|
|||||||
|
|
||||||
if (proxy->comp == NULL) {
|
if (proxy->comp == NULL) {
|
||||||
comp = calloc(1, sizeof(*comp));
|
comp = calloc(1, sizeof(*comp));
|
||||||
|
if (unlikely(!comp)) {
|
||||||
|
memprintf(err, "'%s': out of memory.", args[0]);
|
||||||
|
ret = -1;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
/* Always default to compress responses */
|
/* Always default to compress responses */
|
||||||
comp->flags = COMP_FL_DIR_RES;
|
comp->flags = COMP_FL_DIR_RES;
|
||||||
proxy->comp = comp;
|
proxy->comp = comp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user