Skip to content

Commit aa20905

Browse files
alexanderstephanGarfield96
authored andcommitted
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>
1 parent 73f9a75 commit aa20905

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/flt_http_comp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
830830

831831
if (proxy->comp == NULL) {
832832
comp = calloc(1, sizeof(*comp));
833+
if (unlikely(!comp)) {
834+
memprintf(err, "'%s': out of memory.", args[0]);
835+
ret = -1;
836+
goto end;
837+
}
833838
/* Always default to compress responses */
834839
comp->flags = COMP_FL_DIR_RES;
835840
proxy->comp = comp;

0 commit comments

Comments
 (0)