chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
conf-parser: don't crash when environemnt list is empty
[elogind.git]
/
conf-parser.c
diff --git
a/conf-parser.c
b/conf-parser.c
index aebf61aaf5067a77086be7594c0d0b14506b95dc..8883d9ed6871191633e7dc77580b746b028f7af3 100644
(file)
--- a/
conf-parser.c
+++ b/
conf-parser.c
@@
-368,8
+368,10
@@
int config_parse_strv(
if (!(n = new(char*, k+1)))
return -ENOMEM;
- for (k = 0; (*sv)[k]; k++)
- n[k] = (*sv)[k];
+ if (*sv)
+ for (k = 0; (*sv)[k]; k++)
+ n[k] = (*sv)[k];
+
FOREACH_WORD_QUOTED(w, l, rvalue, state)
if (!(n[k++] = strndup(w, l)))
goto fail;