svn commit: r353068 - head/usr.bin/tftp
Alan Somers
asomers at FreeBSD.org
Thu Oct 3 20:22:26 UTC 2019
Author: asomers
Date: Thu Oct 3 20:22:25 2019
New Revision: 353068
URL: https://svnweb.freebsd.org/changeset/base/353068
Log:
tftp: fix two minor Coverity CIDs
Reported by: Coverity
CID 1394842: file descriptor leak in an error path
CID 1007603: single byte array overflow
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21695
Modified:
head/usr.bin/tftp/main.c
Modified: head/usr.bin/tftp/main.c
==============================================================================
--- head/usr.bin/tftp/main.c Thu Oct 3 20:09:50 2019 (r353067)
+++ head/usr.bin/tftp/main.c Thu Oct 3 20:22:25 2019 (r353068)
@@ -491,6 +491,7 @@ put(int argc, char *argv[])
if (fstat(fd, &sb) < 0) {
warn("%s", cp);
+ close(fd);
return;
}
asprintf(&options[OPT_TSIZE].o_request, "%ju", sb.st_size);
@@ -746,7 +747,7 @@ command(bool interactive, EditLine *el, History *hist,
exit(0);
len = MIN(MAXLINE, num);
memcpy(line, bp, len);
- line[len] = '\0';
+ line[len - 1] = '\0';
history(hist, hep, H_ENTER, bp);
} else {
line[0] = 0;
More information about the svn-src-all
mailing list