diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-12-10 01:04:36 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-10 01:04:36 +0100 |
commit | d63850688da41981f43642fe95cf3d6e00c6d69c (patch) | |
tree | 8df2e406f9b1a043add603af1f93254cefc35a38 /src/libsystemd-bus/bus-message.c | |
parent | f30976971ce902d2ca04157318f5f3c58d63399c (diff) |
bus: handler empty messages correctly when using gvariant marshalling
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 8113744227..b86ef96f83 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -2026,7 +2026,7 @@ static int bus_message_close_struct(sd_bus_message *m, struct bus_container *c, if (!BUS_MESSAGE_IS_GVARIANT(m)) return 0; - p = c->signature; + p = strempty(c->signature); while (*p != 0) { size_t n; @@ -2074,7 +2074,7 @@ static int bus_message_close_struct(sd_bus_message *m, struct bus_container *c, if (!a) return -ENOMEM; - p = c->signature; + p = strempty(c->signature); for (i = 0, j = 0; i < c->n_offsets; i++) { unsigned k; size_t n; @@ -3554,12 +3554,20 @@ static int build_struct_offsets( int r; assert(m); - assert(signature); assert(item_size); assert(offsets); assert(n_offsets); + if (isempty(signature)) { + *item_size = 0; + *offsets = NULL; + *n_offsets = 0; + return 0; + } + sz = determine_word_size(size, 0); + if (sz <= 0) + return -EBADMSG; /* First, loop over signature and count variable elements and * elements in general. We use this to know how large the @@ -5281,7 +5289,7 @@ _public_ const char* sd_bus_message_get_signature(sd_bus_message *m, int complet assert_return(m, NULL); c = complete ? &m->root_container : message_get_container(m); - return c->signature ?: ""; + return strempty(c->signature); } _public_ int sd_bus_message_copy(sd_bus_message *m, sd_bus_message *source, int all) { |