Page MenuHomeFreeBSD

diff: Don't (ab)use sprintf() as a kind of strcat().
ClosedPublic

Authored by jhb on Sep 29 2022, 10:28 PM.
Tags
None
Referenced Files
F115688284: D36814.diff
Sun, Apr 27, 4:11 AM
Unknown Object (File)
Thu, Apr 24, 12:10 AM
Unknown Object (File)
Wed, Apr 23, 10:08 PM
Unknown Object (File)
Wed, Apr 23, 10:07 PM
Unknown Object (File)
Wed, Apr 23, 10:06 PM
Unknown Object (File)
Wed, Apr 23, 10:05 PM
Unknown Object (File)
Mon, Apr 7, 8:09 AM
Unknown Object (File)
Sun, Apr 6, 2:56 AM
Subscribers

Details

Summary

Previously print_header() used sprintf() of a buffer to itself as a
kind of string builder but without checking for overflows. This
raised -Wformat-truncation and -Wrestrict warnings in GCC. Instead,
just conditionally print the new timestamp fields after the initial
strftime()-formatted string. While here, use sizeof(buf) with
strftime() rather than a magic number.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable