mirror of
https://github.com/curl/curl.git
synced 2026-07-27 01:57:15 +03:00
tool_writeout: check strftime() return code
Because if it fails, the contents of the output buffer is undefined.
Pointed out by CodeSonar
Also polished the documentation
Follow-up to fadc487567
Closes #18220
This commit is contained in:
parent
10e60e825c
commit
16eac53dc9
2 changed files with 26 additions and 16 deletions
|
|
@ -603,8 +603,9 @@ static const char *outtime(const char *ptr, /* %time{ ... */
|
|||
if(!result) {
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
utc = gmtime(&secs);
|
||||
strftime(output, sizeof(output), curlx_dyn_ptr(&format), utc);
|
||||
fputs(output, stream);
|
||||
if(curlx_dyn_len(&format) &&
|
||||
strftime(output, sizeof(output), curlx_dyn_ptr(&format), utc))
|
||||
fputs(output, stream);
|
||||
curlx_dyn_free(&format);
|
||||
}
|
||||
ptr = end + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue