HomeFreeBSD

tftpd: Add missing `-S` option to synopsis.

Description

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)

Details

Provenance
desAuthored on Fri, May 10, 9:15 PM
Reviewer
imp
Differential Revision
D45129: tftpd: Add missing `-S` option to synopsis.
Parents
rGafd1256257f5: cat: Check for lack of success rather than a specific failure.
Branches
Unknown
Tags
Unknown