diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-04-16 01:50:10 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-04-16 02:03:34 +0200 |
commit | 5d6ab905c00342d012aed559a859b373512e4650 (patch) | |
tree | 0230a39d109bbfe07d90cd3b3270b234222af3bb /src/strv.c | |
parent | ede27aab11cda3f55c2cd2e1e28e2385b3f64453 (diff) |
strv: detect non-assignments in env blocks properly in env_append()
Diffstat (limited to 'src/strv.c')
-rw-r--r-- | src/strv.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/strv.c b/src/strv.c index c8ebb648d6..0afd9865d9 100644 --- a/src/strv.c +++ b/src/strv.c @@ -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) |