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)
Fri, May 8, 9:14 PM
Unknown Object (File)
Sun, May 3, 12:25 AM
Unknown Object (File)
Sat, May 2, 12:00 PM
Unknown Object (File)
Fri, May 1, 9:55 PM
Unknown Object (File)
Tue, Apr 28, 9:43 AM
Unknown Object (File)
Fri, Apr 24, 6:25 PM
Unknown Object (File)
Fri, Apr 24, 1:15 AM
Unknown Object (File)
Fri, Apr 24, 12:41 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