summaryrefslogtreecommitdiff
path: root/src/run
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2022-01-26 10:53:40 -0800
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-01-27 13:45:00 +0900
commit1d3b68f6e1538b6a86cbe3650d8b81df2877ef42 (patch)
tree7e6eecac1e65b796cc894dfb4bcee2377ba8bf9d /src/run
parentf223fd6addad51e1661d3baa409eb12de5065817 (diff)
downloadsystemd-1d3b68f6e1538b6a86cbe3650d8b81df2877ef42.tar.gz
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.c7
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);