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)
Fri, Sep 11, 4:16 AM
Unknown Object (File)
Thu, Sep 10, 10:27 PM
Unknown Object (File)
Sat, Sep 5, 11:42 AM
Unknown Object (File)
Sat, Sep 5, 7:44 AM
Unknown Object (File)
Fri, Sep 4, 5:07 PM
Unknown Object (File)
Thu, Sep 3, 2:52 PM
Unknown Object (File)
Tue, Sep 1, 2:46 PM
Unknown Object (File)
Tue, Sep 1, 12:26 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 47628
Build 44515: arc lint + arc unit