summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 3f9baca806..428568dcc2 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -3585,12 +3585,18 @@ _public_ int sd_bus_message_read_array(sd_bus_message *m,
c = message_get_container(m);
sz = BUS_MESSAGE_BSWAP32(m, *c->array_size);
- r = message_peek_body(m, &m->rindex, align, sz, &p);
- if (r < 0)
- goto fail;
- if (r == 0) {
- r = -EBADMSG;
- goto fail;
+ if (sz == 0)
+ /* Zero length array, let's return some aligned
+ * pointer that is not NULL */
+ p = (uint8_t*) NULL + align;
+ else {
+ r = message_peek_body(m, &m->rindex, align, sz, &p);
+ if (r < 0)
+ goto fail;
+ if (r == 0) {
+ r = -EBADMSG;
+ goto fail;
+ }
}
r = sd_bus_message_exit_container(m);