summaryrefslogtreecommitdiffstats
path: root/pw/pw_conf.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 10:15:36 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-05-10 10:15:36 +0000
commit53c8f1f32d75577a289f6062e2db339e7167657f (patch)
tree661e0975f16b3f38507a647c29694b8841335514 /pw/pw_conf.c
parent49910924b696011d0262f72b0e3526c3667a900f (diff)
downloadpw-darwin-53c8f1f32d75577a289f6062e2db339e7167657f.tar.gz
pw-darwin-53c8f1f32d75577a289f6062e2db339e7167657f.tar.zst
pw-darwin-53c8f1f32d75577a289f6062e2db339e7167657f.zip
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.
Diffstat (limited to 'pw/pw_conf.c')
-rw-r--r--pw/pw_conf.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/pw/pw_conf.c b/pw/pw_conf.c
index 46474a1..e988f4b 100644
--- a/pw/pw_conf.c
+++ b/pw/pw_conf.c
@@ -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);
}