summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-30 17:34:15 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-31 14:33:12 -0400
commit27f6e5c7823f0b763a92d2938d222b900c5d70e6 (patch)
tree3609b9868f171198093f21ba2688855bcc5711d3 /src/libsystemd-bus
parent10d18763ec6f31ded1535f810be765f7fab2d97d (diff)
bus: check return value from bus_type_get_alignment/size
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-message.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 85b9cbaae0..c7cc32ec15 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -784,7 +784,7 @@ static void *message_extend_body(sd_bus_message *m, size_t align, size_t sz) {
int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored) {
struct bus_container *c;
- size_t sz, align;
+ ssize_t align, sz;
uint32_t k;
void *a;
char *e = NULL;
@@ -1590,10 +1590,12 @@ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
}
default: {
- size_t sz, align, rindex;
+ ssize_t sz, align;
+ size_t rindex;
align = bus_type_get_alignment(type);
sz = bus_type_get_size(type);
+ assert(align > 0 && sz > 0);
rindex = m->rindex;
r = message_peek_body(m, &rindex, align, sz, &q);
@@ -2392,10 +2394,11 @@ static int message_skip_fields(
(*signature)++;
} else if (bus_type_is_basic(t)) {
- size_t align, k;
+ ssize_t align, k;
align = bus_type_get_alignment(t);
k = bus_type_get_size(t);
+ assert(align > 0 && k > 0);
r = message_peek_fields(m, ri, align, k, NULL);
if (r < 0)