diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 10:15:36 +0000 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-05-10 10:15:36 +0000 |
| commit | 97f18faf798474452fd15880e7e8c81d786465e7 (patch) | |
| tree | 7deeaf31b0496fa849298c3819ecf26bc6163069 | |
| parent | 23c65c2198c1b58184f7fafd8a70e8274fe1e91a (diff) | |
| download | pw-darwin-97f18faf798474452fd15880e7e8c81d786465e7.tar.gz pw-darwin-97f18faf798474452fd15880e7e8c81d786465e7.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.
| -rw-r--r-- | pw/pw_conf.c | 7 |
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); } |
