mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
BUG/MINOR: proxy: Missing calloc return value check in proxy_defproxy_cpy
A memory allocation failure happening in proxy_defproxy_cpy while copying the default compression options would have resulted in a crash. This function is called for every new proxy found while parsing the configuration. It was raised in GitHub issue #1233. It could be backported to all stable branches.
This commit is contained in:
parent
55ba0d6865
commit
18a82ba690
@ -1717,6 +1717,10 @@ static int proxy_defproxy_cpy(struct proxy *curproxy, const struct proxy *defpro
|
|||||||
/* default compression options */
|
/* default compression options */
|
||||||
if (defproxy->comp != NULL) {
|
if (defproxy->comp != NULL) {
|
||||||
curproxy->comp = calloc(1, sizeof(*curproxy->comp));
|
curproxy->comp = calloc(1, sizeof(*curproxy->comp));
|
||||||
|
if (!curproxy->comp) {
|
||||||
|
memprintf(errmsg, "proxy '%s': out of memory for default compression options", curproxy->id);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
curproxy->comp->algos = defproxy->comp->algos;
|
curproxy->comp->algos = defproxy->comp->algos;
|
||||||
curproxy->comp->types = defproxy->comp->types;
|
curproxy->comp->types = defproxy->comp->types;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user