diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-15 14:05:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-15 14:05:03 +0200 |
commit | 6c03089c32c251d823173bda4d809a9e643219f0 (patch) | |
tree | 8dc4afd1fe07208b30f5849954404b30b209c660 /src/libsystemd-bus/sd-bus.c | |
parent | 4a875b6133c9ef0e984547f7ce3b09356be4f7bc (diff) |
bus: handle env vars safely
Make sure that our library is safe for usage in SUID programs when it
comes to env var handling
Diffstat (limited to 'src/libsystemd-bus/sd-bus.c')
-rw-r--r-- | src/libsystemd-bus/sd-bus.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index f2dd81235f..c7511c32d2 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -31,6 +31,7 @@ #include "macro.h" #include "strv.h" #include "set.h" +#include "missing.h" #include "sd-bus.h" #include "bus-internal.h" @@ -841,7 +842,7 @@ int sd_bus_open_system(sd_bus **ret) { if (r < 0) return r; - e = getenv("DBUS_SYSTEM_BUS_ADDRESS"); + e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS"); if (e) { r = sd_bus_set_address(b, e); if (r < 0) @@ -879,13 +880,13 @@ int sd_bus_open_user(sd_bus **ret) { if (r < 0) return r; - e = getenv("DBUS_SESSION_BUS_ADDRESS"); + e = secure_getenv("DBUS_SESSION_BUS_ADDRESS"); if (e) { r = sd_bus_set_address(b, e); if (r < 0) goto fail; } else { - e = getenv("XDG_RUNTIME_DIR"); + e = secure_getenv("XDG_RUNTIME_DIR"); if (!e) { r = -ENOENT; goto fail; |