From b2cd08bb91ccf3ced6380ea0a9691e7052eb290b Mon Sep 17 00:00:00 2001 From: Denis Balashov Date: Thu, 4 Jun 2026 12:30:39 +0300 Subject: [PATCH] util/log-redis: guard SCCalloc result for redis stream format When Redis output is configured in stream/xadd mode with a positive stream-maxlen, SCConfLogOpenRedis() allocates redis_setup.stream_format and immediately passes it to snprintf(). If SCCalloc() fails, snprintf() receives a NULL destination pointer and the process can crash during Redis output initialization. Handle this unrecoverable setup failure with FatalError(), matching the surrounding Redis initialization error handling. Ticket: 8588 --- src/util-log-redis.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util-log-redis.c b/src/util-log-redis.c index f0755e7473..adc6b23f7e 100644 --- a/src/util-log-redis.c +++ b/src/util-log-redis.c @@ -673,6 +673,9 @@ int SCConfLogOpenRedis(SCConfNode *redis_node, void *lf_ctx) format string, whose length is limited by the length of the maxlen integer formatted as a string */ log_ctx->redis_setup.stream_format = SCCalloc(100, sizeof(char)); + if (unlikely(log_ctx->redis_setup.stream_format == NULL)) { + FatalError("Unable to allocate redis stream format"); + } snprintf(log_ctx->redis_setup.stream_format, 100, redis_stream_format_maxlen_tmpl, "%s", "%s", exact ? '=' : '~', maxlen, "%s"); log_ctx->redis_setup.format = log_ctx->redis_setup.stream_format;