svn commit: r282719 - head/usr.sbin/pw

Baptiste Daroussin bapt at FreeBSD.org
Sun May 10 10:15:37 UTC 2015


Author: bapt
Date: Sun May 10 10:15:36 2015
New Revision: 282719
URL: https://svnweb.freebsd.org/changeset/base/282719

Log:
  The initial logic for allocating the new string was wrong, the conversion
  to strndup(3) duplicated the same mistake, actually strdup(3) is good enough
  to allocate the new string.

Modified:
  head/usr.sbin/pw/pw_conf.c

Modified: head/usr.sbin/pw/pw_conf.c
==============================================================================
--- head/usr.sbin/pw/pw_conf.c	Sun May 10 10:02:09 2015	(r282718)
+++ head/usr.sbin/pw/pw_conf.c	Sun May 10 10:15:36 2015	(r282719)
@@ -213,15 +213,12 @@ char           *
 newstr(char const * p)
 {
 	char	*q;
-	size_t	 l;
 
 	if ((p = unquote(p)) == NULL)
 		return (NULL);
 
-	l = strlen(p) + 1;
-
-	if ((q = strndup(p, l)) == NULL)
-		err(1, "strndup()");
+	if ((q = strdup(p)) == NULL)
+		err(1, "strdup()");
 
 	return (q);
 }


More information about the svn-src-all mailing list