From 3251df7dd7e88571108c1dc8a6c9f66cf891321b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Apr 2010 02:37:47 +0200 Subject: conf-parser: don't crash when environemnt list is empty --- conf-parser.c | 6 ++++-- 1 file 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; -- cgit v1.2.3-54-g00ecf