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
Unknown Object (File)
Thu, Aug 13, 8:52 PM
Unknown Object (File)
Wed, Aug 12, 12:32 PM
Unknown Object (File)
Wed, Aug 12, 12:32 PM
Unknown Object (File)
Wed, Aug 12, 12:07 PM
Unknown Object (File)
Wed, Aug 12, 1:43 AM
Unknown Object (File)
Mon, Aug 10, 4:50 PM
Unknown Object (File)
Sat, Aug 8, 6:09 PM
Unknown Object (File)
Mon, Aug 3, 9:06 PM
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