Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Dec 2011 23:35:46 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228670 - head/usr.sbin/pkg_install/updating
Message-ID:  <201112172335.pBHNZk04081607@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Dec 17 23:35:46 2011
New Revision: 228670
URL: http://svn.freebsd.org/changeset/base/228670

Log:
  In usr.sbin/pkg_install/updating/main.c, use the size of the destination
  buffer as size argument to strlcpy(), not the length of the source.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/pkg_install/updating/main.c

Modified: head/usr.sbin/pkg_install/updating/main.c
==============================================================================
--- head/usr.sbin/pkg_install/updating/main.c	Sat Dec 17 23:18:14 2011	(r228669)
+++ head/usr.sbin/pkg_install/updating/main.c	Sat Dec 17 23:35:46 2011	(r228670)
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
 					strcmp(pkgdbdir->d_name, "..") != 0) {
 
 					/* Create path to +CONTENTS file for each installed port */
-					n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1);
+					n = strlcpy(tmp_file, pkgdbpath, sizeof(tmp_file));
 					n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n);
 					n = strlcat(tmp_file + n, pkgdbdir->d_name,
 						sizeof(tmp_file) - n);
@@ -181,7 +181,7 @@ main(int argc, char *argv[])
 								(void)exit(EXIT_FAILURE);
 							if (pname[strlen(pname) - 1] == '\n')
 								pname[strlen(pname) - 1] = '\0';
-							strlcpy (curr->name, pname, strlen(pname)+1);
+							strlcpy (curr->name, pname, sizeof(curr->name));
 							curr->next = head;
 							head = curr;
 						}



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