From 065a6531583d58b4f2fdf81e83863ccf3158ff7f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 8 Aug 2025 09:24:46 +0200 Subject: [PATCH] tool_writeout: check gmtime return code too If the unlikely event happen that it fails, it returns NULL. CodeSonar is not happy unless we check for it. Closes #18225 --- src/tool_writeout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 2469712745..0a610de79a 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -603,7 +603,7 @@ static const char *outtime(const char *ptr, /* %time{ ... */ if(!result) { /* !checksrc! disable BANNEDFUNC 1 */ utc = gmtime(&secs); - if(curlx_dyn_len(&format) && + if(curlx_dyn_len(&format) && utc && strftime(output, sizeof(output), curlx_dyn_ptr(&format), utc)) fputs(output, stream); curlx_dyn_free(&format); -- 2.47.3