summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-06 02:37:47 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-06 02:37:47 +0200
commit3251df7dd7e88571108c1dc8a6c9f66cf891321b (patch)
tree2fdcea72236d3535ae017b099eac4091fb0d641b
parent63ad1ab4f333351914abf0c3e78d4b3fa2e1cb66 (diff)
conf-parser: don't crash when environemnt list is empty
-rw-r--r--conf-parser.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/conf-parser.c b/conf-parser.c
index aebf61aaf5..8883d9ed68 100644
--- 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;