]> err.no Git - systemd/commitdiff
conf-parser: don't crash when environemnt list is empty
authorLennart Poettering <lennart@poettering.net>
Tue, 6 Apr 2010 00:37:47 +0000 (02:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Apr 2010 00:37:47 +0000 (02:37 +0200)
conf-parser.c

index aebf61aaf5067a77086be7594c0d0b14506b95dc..8883d9ed6871191633e7dc77580b746b028f7af3 100644 (file)
@@ -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;