From 15912917ef8b96124bd2553d5ae851c1b113efd8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Nov 2013 16:44:33 +0100 Subject: bus: message_append_basic() - allow string == NULL --- src/libsystemd-bus/bus-message.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/libsystemd-bus/bus-message.c') diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 9543ae3b26..4b53a6c509 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -1323,7 +1323,6 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void int r; assert_return(m, -EINVAL); - assert_return(p, -EINVAL); assert_return(!m->sealed, -EPERM); assert_return(bus_type_is_basic(type), -EINVAL); assert_return(!m->poisoned, -ESTALE); @@ -1380,6 +1379,11 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void break; case SD_BUS_TYPE_BOOLEAN: + if (!p) { + r = -EINVAL; + goto fail; + } + align = sz = 4; assert_cc(sizeof(int) == sizeof(uint32_t)); @@ -1391,6 +1395,11 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void case SD_BUS_TYPE_UNIX_FD: { int z, *f; + if (!p) { + r = -EINVAL; + goto fail; + } + if (!m->allow_fds) { r = -ENOTSUP; goto fail; -- cgit v1.2.3-54-g00ecf