Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Oct 2019 01:41:49 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r354163 - stable/12/usr.bin/tftp
Message-ID:  <201910300141.x9U1fn2j005493@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Wed Oct 30 01:41:49 2019
New Revision: 354163
URL: https://svnweb.freebsd.org/changeset/base/354163

Log:
  MFC r353068:
  
  tftp: fix two minor Coverity CIDs
  
  Reported by:	Coverity
  CID 1394842: file descriptor leak in an error path
  CID 1007603: single byte array overflow
  Differential Revision:	https://reviews.freebsd.org/D21695

Modified:
  stable/12/usr.bin/tftp/main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.bin/tftp/main.c
==============================================================================
--- stable/12/usr.bin/tftp/main.c	Wed Oct 30 01:41:14 2019	(r354162)
+++ stable/12/usr.bin/tftp/main.c	Wed Oct 30 01:41:49 2019	(r354163)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910300141.x9U1fn2j005493>