diff options
author | Anita Zhang <the.anitazha@gmail.com> | 2022-01-26 19:53:40 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-01-27 05:45:00 +0100 |
commit | 1d3b68f6e1538b6a86cbe3650d8b81df2877ef42 (patch) | |
tree | 7e6eecac1e65b796cc894dfb4bcee2377ba8bf9d /src/run | |
parent | docs: fix typos and improve language (diff) | |
download | systemd-1d3b68f6e1538b6a86cbe3650d8b81df2877ef42.tar.xz systemd-1d3b68f6e1538b6a86cbe3650d8b81df2877ef42.zip |
tree-wide: don't use strjoina() on getenv() values
Avoid doing stack allocations on environment variables.
Diffstat (limited to 'src/run')
-rw-r--r-- | src/run/run.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/run/run.c b/src/run/run.c index ff24373847..e75b027542 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -794,9 +794,12 @@ static int transient_service_set_properties(sd_bus_message *m, const char *pty_p e = getenv("TERM"); if (e) { - char *n; + _cleanup_free_ char *n = NULL; + + n = strjoin("TERM=", e); + if (!n) + return log_oom(); - n = strjoina("TERM=", e); r = sd_bus_message_append(m, "(sv)", "Environment", "as", 1, n); |