svn commit: r292877 - head/bin/pax

Pedro F. Giffuni pfg at FreeBSD.org
Tue Dec 29 16:31:29 UTC 2015


Author: pfg
Date: Tue Dec 29 16:31:28 2015
New Revision: 292877
URL: https://svnweb.freebsd.org/changeset/base/292877

Log:
  pax: prevent possible buffer overflow
  
  Or at least quiet down some static analyzers about it.
  
  CID:	978835
  MFC after:	1 week
  Obtained from:	OpenBSD

Modified:
  head/bin/pax/pat_rep.c

Modified: head/bin/pax/pat_rep.c
==============================================================================
--- head/bin/pax/pat_rep.c	Tue Dec 29 16:29:42 2015	(r292876)
+++ head/bin/pax/pat_rep.c	Tue Dec 29 16:31:28 2015	(r292877)
@@ -878,7 +878,7 @@ rep_name(char *name, int *nlen, int prnt
 	 * (the user already saw that substitution go by)
 	 */
 	pt = rephead;
-	(void)strcpy(buf1, name);
+	(void)strlcpy(buf1, name, sizeof(buf1));
 	inpt = buf1;
 	outpt = nname;
 	endpt = outpt + PAXPATHLEN;


More information about the svn-src-head mailing list