diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-05-10 21:15:54 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-05-10 21:16:26 +0000 |
commit | 25945af47e7a1d06c44c8c160045a866e90569ab (patch) | |
tree | 0ba5dfc86d06fb30f146899e65888057fbd499a6 /sys | |
parent | 4d09eb87c5d5bec2e2832f50537e2ce6f75f4117 (diff) | |
download | src-25945af47e7a1d06c44c8c160045a866e90569ab.tar.gz src-25945af47e7a1d06c44c8c160045a866e90569ab.zip |
tftpd: silence gcc overflow warnings
GCC 13 complains that we might be writing too much to an on-stack buffer
when createing a filename.
In practice there is a check that filename isn't too long given the
time format and other static characters so GCC is incorrect, but GCC
isn't wrong that we're potentially trying to put a MAXPATHLEN length
string + some other characters into a MAXPATHLEN buffer (if you ignore
the check GCC can't realistically evaluate at compile time).
Switch to snprintf to populate filename to ensure that future logic
errors don't result in a stack overflow.
Shorten the questionably named yyyymmdd buffer enough to slience the
warning (checking the snprintf return value isn't sufficent) while
preserving maximum flexibility for admins who use the -F option.
MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D45086
Diffstat (limited to 'sys')
0 files changed, 0 insertions, 0 deletions