Date: Sun, 10 May 2015 10:15:37 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282719 - head/usr.sbin/pw Message-ID: <201505101015.t4AAFbU6036696@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505101015.t4AAFbU6036696>