]> err.no Git - systemd/commitdiff
strv: detect non-assignments in env blocks properly in env_append()
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Apr 2011 23:50:10 +0000 (01:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 16 Apr 2011 00:03:34 +0000 (02:03 +0200)
src/strv.c

index c8ebb648d643e9f43667d77ad00c7850e638cefa..0afd9865d9c7316fd35d155d6388182d64065091 100644 (file)
@@ -358,7 +358,10 @@ char **strv_remove(char **l, const char *s) {
         if (!l)
                 return NULL;
 
-        /* Drops every occurrence of s in the string list */
+        assert(s);
+
+        /* Drops every occurrence of s in the string list, edits
+         * in-place. */
 
         for (f = t = l; *f; f++) {
 
@@ -387,7 +390,12 @@ static int env_append(char **r, char ***k, char **a) {
 
         for (; *a; a++) {
                 char **j;
-                size_t n = strcspn(*a, "=") + 1;
+                size_t n;
+
+                n = strcspn(*a, "=");
+
+                if ((*a)[n] == '=')
+                        n++;
 
                 for (j = r; j < *k; j++)
                         if (strncmp(*j, *a, n) == 0)