mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: http: Missing calloc return value check while parsing tcp-request/tcp-response
A memory allocation failure happening in tcp_parse_tcp_req or tcp_parse_tcp_rep when trying to allocate an act_rule structure would have resulted in a crash. These functions are only called during configuration parsing. It was raised in GitHub issue #1233. It could be backported to all stable branches.
This commit is contained in:
parent
18a82ba690
commit
2ca42b4656
@ -1055,6 +1055,10 @@ static int tcp_parse_tcp_rep(char **args, int section_type, struct proxy *curpx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rule = calloc(1, sizeof(*rule));
|
rule = calloc(1, sizeof(*rule));
|
||||||
|
if (!rule) {
|
||||||
|
memprintf(err, "parsing [%s:%d] : out of memory", file, line);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
LIST_INIT(&rule->list);
|
LIST_INIT(&rule->list);
|
||||||
arg = 1;
|
arg = 1;
|
||||||
where = 0;
|
where = 0;
|
||||||
@ -1169,6 +1173,10 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rule = calloc(1, sizeof(*rule));
|
rule = calloc(1, sizeof(*rule));
|
||||||
|
if (!rule) {
|
||||||
|
memprintf(err, "parsing [%s:%d] : out of memory", file, line);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
LIST_INIT(&rule->list);
|
LIST_INIT(&rule->list);
|
||||||
arg = 1;
|
arg = 1;
|
||||||
where = 0;
|
where = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user