mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-25 06:03:40 +03:00
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:
parent
eecac5053b
commit
1ef9703774
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user