summaryrefslogtreecommitdiff
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-23 18:47:01 +0200
committerLennart Poettering <lennart@poettering.net>2012-09-03 18:59:04 -0700
commit88fae6e0441d4195e089434f07d3e7fd811d6297 (patch)
treef5117932fa7dbf0e7cec4a11d01b87ca521623aa /src/shared/log.c
parentfe1fed02c7637a2c18cd575f78be7fda27972148 (diff)
shared: in code that might get called from suid programs use __secure_getenv() rather than getenv()
It's better to be safe than sorry.
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/shared/log.c b/src/shared/log.c
index 1cbc9d6250..4fc430eed1 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -688,21 +688,21 @@ int log_set_max_level_from_string(const char *e) {
void log_parse_environment(void) {
const char *e;
- if ((e = getenv("SYSTEMD_LOG_TARGET")))
- if (log_set_target_from_string(e) < 0)
- log_warning("Failed to parse log target %s. Ignoring.", e);
+ e = __secure_getenv("SYSTEMD_LOG_TARGET");
+ if (e && log_set_target_from_string(e) < 0)
+ log_warning("Failed to parse log target %s. Ignoring.", e);
- if ((e = getenv("SYSTEMD_LOG_LEVEL")))
- if (log_set_max_level_from_string(e) < 0)
- log_warning("Failed to parse log level %s. Ignoring.", e);
+ e = __secure_getenv("SYSTEMD_LOG_LEVEL");
+ if (e && log_set_max_level_from_string(e) < 0)
+ log_warning("Failed to parse log level %s. Ignoring.", e);
- if ((e = getenv("SYSTEMD_LOG_COLOR")))
- if (log_show_color_from_string(e) < 0)
- log_warning("Failed to parse bool %s. Ignoring.", e);
+ e = __secure_getenv("SYSTEMD_LOG_COLOR");
+ if (e && log_show_color_from_string(e) < 0)
+ log_warning("Failed to parse bool %s. Ignoring.", e);
- if ((e = getenv("SYSTEMD_LOG_LOCATION")))
- if (log_show_location_from_string(e) < 0)
- log_warning("Failed to parse bool %s. Ignoring.", e);
+ e = __secure_getenv("SYSTEMD_LOG_LOCATION");
+ if (e && log_show_location_from_string(e) < 0)
+ log_warning("Failed to parse bool %s. Ignoring.", e);
}
LogTarget log_get_target(void) {