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, Nov 14, 7:10 AM
Unknown Object (File)
Oct 5 2024, 1:34 AM
Unknown Object (File)
Oct 3 2024, 4:47 PM
Unknown Object (File)
Oct 3 2024, 1:30 AM
Unknown Object (File)
Oct 1 2024, 4:12 PM
Unknown Object (File)
Sep 30 2024, 10:19 AM
Unknown Object (File)
Sep 28 2024, 11:57 PM
Unknown Object (File)
Sep 28 2024, 8: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