diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-01-05 16:06:35 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-01-05 16:06:35 +0100 |
commit | 5f7c426e2a7f72c473f98be9978d243db79d8910 (patch) | |
tree | be5023d062e91526d7394d6624dc0e2d44d6cd5c /src/load-fragment.c | |
parent | 38752828029e72e72d80519bb6c67354782ddb72 (diff) |
fragment: properly handle quotes in assignments in EnvironmentFile= files
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r-- | src/load-fragment.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c index 1b23205a2f..281863264e 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1360,7 +1360,7 @@ static int config_parse_env_file( } while (!feof(f)) { - char l[LINE_MAX], *p; + char l[LINE_MAX], *p, *u; char **t; if (!fgets(l, sizeof(l), f)) { @@ -1381,7 +1381,21 @@ static int config_parse_env_file( if (strchr(COMMENTS, *p)) continue; - t = strv_env_set(*env, p); + if (!(u = normalize_env_assignment(p))) { + log_error("Out of memory"); + r = -ENOMEM; + goto finish; + } + + t = strv_env_set(*env, u); + free(u); + + if (!t) { + log_error("Out of memory"); + r = -ENOMEM; + goto finish; + } + strv_free(*env); *env = t; } |