diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-18 14:06:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-18 14:07:44 +0200 |
commit | 1daf8121524246932b18be8dd7d63e792dee5de2 (patch) | |
tree | c1e1f585751837b93c416e39879811818532c0a7 /src/libsystemd-bus/bus-message.c | |
parent | 89456fcee469882bad8566aa0947c7aadadfde91 (diff) |
bus: if we hit the end of an array container return 0 as EOF indicator when reading it
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index bb339f5a82..511bdf503e 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -2659,6 +2659,9 @@ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) { if (!c->signature || c->signature[c->index] == 0) return 0; + if (message_end_of_array(m, m->rindex)) + return 0; + if (c->signature[c->index] != type) return -ENXIO; @@ -3007,6 +3010,9 @@ int sd_bus_message_enter_container(sd_bus_message *m, char type, const char *con if (!c->signature || c->signature[c->index] == 0) return 0; + if (message_end_of_array(m, m->rindex)) + return 0; + signature = strdup(contents); if (!signature) return -ENOMEM; |