mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-21 13:16:57 +00:00
BUG/MINOR: http: Missing calloc return value check in make_arg_list
A memory allocation failure happening in make_arg_list when trying to allocate the argument list would have resulted in a crash. This function is 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
b6864a5b6f
commit
17acbab0ac
@ -149,6 +149,9 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp,
|
||||
|
||||
arg = *argp = calloc(nbarg + 1, sizeof(**argp));
|
||||
|
||||
if (!arg)
|
||||
goto alloc_err;
|
||||
|
||||
/* Note: empty arguments after a comma always exist. */
|
||||
while (pos < nbarg) {
|
||||
unsigned int uint;
|
||||
@ -439,4 +442,7 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp,
|
||||
in, trash.area, arg_type_names[(mask >> (pos * ARGT_BITS)) & ARGT_MASK], pos + 1);
|
||||
goto err;
|
||||
|
||||
alloc_err:
|
||||
memprintf(err_msg, "out of memory");
|
||||
goto err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user