Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 00:45:09 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316803 - head/contrib/tcp_wrappers
Message-ID:  <201704140045.v3E0j9je027845@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Fri Apr 14 00:45:09 2017
New Revision: 316803
URL: https://svnweb.freebsd.org/changeset/base/316803

Log:
  tcp_wrappers: Sprinkle some bounds-checked string copying
  
  It isn't clear if tcpd.c is even compiled in FreeBSD.
  
  Reported by:	Coverity
  CIDs:		1006710, 1006804
  Sponsored by:	Dell EMC Isilon

Modified:
  head/contrib/tcp_wrappers/tcpd.c

Modified: head/contrib/tcp_wrappers/tcpd.c
==============================================================================
--- head/contrib/tcp_wrappers/tcpd.c	Fri Apr 14 00:36:45 2017	(r316802)
+++ head/contrib/tcp_wrappers/tcpd.c	Fri Apr 14 00:45:09 2017	(r316803)
@@ -62,10 +62,10 @@ char  **argv;
      */
 
     if (argv[0][0] == '/') {
-	strcpy(path, argv[0]);
+	strlcpy(path, argv[0], sizeof(path));
 	argv[0] = strrchr(argv[0], '/') + 1;
     } else {
-	sprintf(path, "%s/%s", REAL_DAEMON_DIR, argv[0]);
+	snprintf(path, sizeof(path), "%s/%s", REAL_DAEMON_DIR, argv[0]);
     }
 
     /*



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