From: Daniel Stenberg Date: Fri, 8 Aug 2025 07:24:46 +0000 (+0200) Subject: tool_writeout: check gmtime return code too X-Git-Tag: curl-8_16_0~213 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=065a6531583d58b4f2fdf81e83863ccf3158ff7f;p=thirdparty%2Fcurl.git 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 --- 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);