From: Lennart Poettering Date: Tue, 6 Apr 2010 00:37:47 +0000 (+0200) Subject: conf-parser: don't crash when environemnt list is empty X-Git-Tag: 0.git+20100605+dfd8ee-1~264 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3251df7dd7e88571108c1dc8a6c9f66cf891321b;p=systemd conf-parser: don't crash when environemnt list is empty --- diff --git a/conf-parser.c b/conf-parser.c index aebf61aa..8883d9ed 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;