mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
strv: detect non-assignments in env blocks properly in env_append()
This commit is contained in:
parent
ede27aab11
commit
5d6ab905c0
12
src/strv.c
12
src/strv.c
@ -358,7 +358,10 @@ char **strv_remove(char **l, const char *s) {
|
|||||||
if (!l)
|
if (!l)
|
||||||
return NULL;
|
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++) {
|
for (f = t = l; *f; f++) {
|
||||||
|
|
||||||
@ -387,7 +390,12 @@ static int env_append(char **r, char ***k, char **a) {
|
|||||||
|
|
||||||
for (; *a; a++) {
|
for (; *a; a++) {
|
||||||
char **j;
|
char **j;
|
||||||
size_t n = strcspn(*a, "=") + 1;
|
size_t n;
|
||||||
|
|
||||||
|
n = strcspn(*a, "=");
|
||||||
|
|
||||||
|
if ((*a)[n] == '=')
|
||||||
|
n++;
|
||||||
|
|
||||||
for (j = r; j < *k; j++)
|
for (j = r; j < *k; j++)
|
||||||
if (strncmp(*j, *a, n) == 0)
|
if (strncmp(*j, *a, n) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user