From 26776c7b8f963299585300472a2b29ad39e47943 Mon Sep 17 00:00:00 2001 From: Alexander Stephan Date: Mon, 1 Sep 2025 10:01:50 +0000 Subject: [PATCH] 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 --- src/tools.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools.c b/src/tools.c index 4507564bc..1615ef2ae 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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 */ -- 2.47.3