Page MenuHomeFreeBSD

tftp: Simplify URI handling
ClosedPublic

Authored by des on Mon, May 18, 9:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 11, 8:27 AM
Unknown Object (File)
Sun, Jun 7, 6:26 AM
Unknown Object (File)
Sun, Jun 7, 6:21 AM
Unknown Object (File)
Fri, Jun 5, 10:11 AM
Unknown Object (File)
Fri, Jun 5, 10:07 AM
Unknown Object (File)
Sat, May 30, 7:12 PM
Unknown Object (File)
Sat, May 30, 10:00 AM
Unknown Object (File)
Fri, May 29, 9:20 PM
Subscribers

Details

Summary
  • No need to copy our argument into a new buffer; it is writeable and will not be reused after we return.
  • Instead of constructing the string "get path" and then splitting it into an argument vector, just construct the vector directly. This avoid potentially overrunning the buffer.
  • Call settftpmode() just once, with either the default mode or the user-provided value we already validated.
  • Use errx() instead of fprintf(stderr) + exit().

Reported by: Moyao, Minghao Fu
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable