nulstr-util: use memdup_suffix0() where appropriate

if the nulstr is not nul-terminated, we shouldn't use strndup() but
memdup_suffix0(), to not trip up static analyzers which imply we are
duping a string here.
This commit is contained in:
Lennart Poettering
2022-11-13 17:39:08 +09:00
committed by Yu Watanabe
parent eecac5053b
commit 1ef9703774
+1 -1
View File
@@ -37,7 +37,7 @@ char** strv_parse_nulstr(const char *s, size_t l) {
e = memchr(p, 0, s + l - p);
v[i] = strndup(p, e ? e - p : s + l - p);
v[i] = memdup_suffix0(p, e ? e - p : s + l - p);
if (!v[i])
return NULL;