mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
BUG/MINOR: tools: Add OOM check for malloc() in indent_msg()
This patch adds a missing out-of-memory (OOM) check after the call to `malloc()` in `indent_msg()`. If memory allocation fails, the function returns NULL to prevent undefined behavior. Co-authored-by: Christian Norbert Menges <christian.norbert.menges@sap.com>
This commit is contained in:
parent
aa20905ac9
commit
26776c7b8f
@ -4689,6 +4689,8 @@ char *indent_msg(char **out, int level)
|
||||
|
||||
needed = 1 + level * (lf + 1) + len + 1;
|
||||
p = ret = malloc(needed);
|
||||
if (unlikely(!ret))
|
||||
return NULL;
|
||||
in = *out;
|
||||
|
||||
/* skip initial LFs */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user