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
F166234725: D36814.id111231.diff
Wed, Aug 12, 12:32 PM
F166234708: D36814.id113169.diff
Wed, Aug 12, 12:32 PM
F166229974: D36814.diff
Wed, Aug 12, 12:07 PM
F166169713: D36814.id111231.diff
Wed, Aug 12, 1:43 AM
Unknown Object (File)
Mon, Aug 10, 4:50 PM
Unknown Object (File)
Sat, Aug 8, 6:09 PM
Unknown Object (File)
Mon, Aug 3, 9:06 PM
Unknown Object (File)
Sun, Jul 26, 10:34 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