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