opnsense-src/libexec/tftpd
Dag-Erling Smørgrav 626ee3cac8 tftpd: Add missing -S option to synopsis.
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D45129

(cherry picked from commit 816c4d3dcf99adcd40a03d93431237ddbd23bbdf)

tftpd: Drop unneeded includes.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D45130

(cherry picked from commit 1111da6b7c612c571453a23a8dd02fd5e7e40b18)

tftpd: Add missing include.

This went unnoticed due to namespace pollution in our headers.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45131

(cherry picked from commit ae285a8cbf1212bdc1b3f81219635bc1395fadee)

tftpd: Satisfy clang-analyzer.

* Replace `random()` with `arc4random()`.
* Change some variable types.
* Drop some unused assignments.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D45132

(cherry picked from commit 4d09eb87c5d5bec2e2832f50537e2ce6f75f4117)

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

(cherry picked from commit 25945af47e7a1d06c44c8c160045a866e90569ab)
2024-05-14 08:58:40 +02:00
..
tests tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06: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 Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
tftp-file.h tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-io.c tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-io.h tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-options.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
tftp-options.h tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-transfer.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
tftp-transfer.h tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-utils.c tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftp-utils.h tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftpd.8 tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00
tftpd.c tftpd: Add missing -S option to synopsis. 2024-05-14 08:58:40 +02:00