freebsd-src/libexec/tftpd
Dag-Erling Smørgrav 25945af47e 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
2024-05-10 23:16:26 +02:00
..
tests tftpd: Add missing include. 2024-05-10 23:16:26 +02:00
Makefile libexec: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tftp-file.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-file.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-io.c tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftp-io.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-options.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-options.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-transfer.c libexec: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
tftp-transfer.h tftpd: Drop unneeded includes. 2024-05-10 23:16:26 +02:00
tftp-utils.c tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftp-utils.h tftpd: Satisfy clang-analyzer. 2024-05-10 23:16:26 +02:00
tftpd.8 tftpd: Add missing -S option to synopsis. 2024-05-10 23:16:26 +02:00
tftpd.c tftpd: silence gcc overflow warnings 2024-05-10 23:16:26 +02:00