Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2018 08:04:32 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330643 - stable/11/usr.bin/banner
Message-ID:  <201803080804.w2884Wgc080119@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu Mar  8 08:04:32 2018
New Revision: 330643
URL: https://svnweb.freebsd.org/changeset/base/330643

Log:
  MFC r316797:
  
  banner(6): Squash a harmless coverity warning
  
  The destination buffer is sized as the sum of program argument lengths, so
  it has plenty of room for *argv.  Appease Coverity by using strlcpy instead
  of strcpy.  Similar to a nearby cleanup performed in r316500.
  
  No functional change.

Modified:
  stable/11/usr.bin/banner/banner.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/banner/banner.c
==============================================================================
--- stable/11/usr.bin/banner/banner.c	Thu Mar  8 08:02:51 2018	(r330642)
+++ stable/11/usr.bin/banner/banner.c	Thu Mar  8 08:04:32 2018	(r330643)
@@ -1062,7 +1062,7 @@ main(int argc, char *argv[])
 			j += strlen(argv[i]) + 1;
 		if ((message = malloc((size_t)j)) == NULL) 
 			err(1, "malloc");
-		strcpy(message, *argv);
+		strlcpy(message, *argv, j);
 		while (*++argv) {
 			strlcat(message, " ", j);
 			strlcat(message, *argv, j);



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