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)
Nov 22 2024, 4:50 PM
Unknown Object (File)
Nov 19 2024, 1:48 PM
Unknown Object (File)
Nov 15 2024, 10:35 PM
Unknown Object (File)
Nov 14 2024, 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
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