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)
Mon, Mar 17, 5:25 PM
Unknown Object (File)
Sat, Mar 15, 2:55 PM
Unknown Object (File)
Fri, Mar 14, 5:09 AM
Unknown Object (File)
Sat, Mar 8, 3:50 AM
Unknown Object (File)
Fri, Mar 7, 11:26 PM
Unknown Object (File)
Mar 6 2025, 11:56 AM
Unknown Object (File)
Mar 3 2025, 8:43 PM
Unknown Object (File)
Feb 26 2025, 1:04 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