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)
Jan 12 2024, 8:27 AM
Unknown Object (File)
Dec 23 2023, 1:13 AM
Unknown Object (File)
Aug 6 2023, 3:02 AM
Unknown Object (File)
Aug 1 2023, 12:07 AM
Unknown Object (File)
Aug 1 2023, 12:06 AM
Unknown Object (File)
Jul 31 2023, 11:41 PM
Unknown Object (File)
Jul 7 2023, 11:48 PM
Unknown Object (File)
May 10 2023, 9:51 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