[systemd-commits] src/libsystemd
Daniel Mack
zonque at kemper.freedesktop.org
Thu Oct 9 02:27:16 PDT 2014
src/libsystemd/sd-bus/sd-bus.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit b1543c4c93855b61b40118e9f14a0423dac2e078
Author: Daniel Mack <daniel at zonque.org>
Date: Thu Oct 9 11:26:09 2014 +0200
sd-bus: check return value of asprintf()
Check for OOM conditions of asprintf() in bus_set_address_user().
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index bc4376f..549f9e0 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1163,7 +1163,11 @@ int bus_set_address_user(sd_bus *b) {
#endif
} else {
#ifdef ENABLE_KDBUS
- asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
+ int r;
+
+ r = asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
+ if (r < 0)
+ return -ENOMEM;
#else
return -ECONNREFUSED;
#endif
More information about the systemd-commits
mailing list