diff --git a/src/bus/driver.c b/src/bus/driver.c index 1fd08805..373172e2 100644 --- a/src/bus/driver.c +++ b/src/bus/driver.c @@ -329,7 +329,7 @@ static int driver_monitor(Bus *bus, Peer *sender, Message *message) { filter.member = message->metadata.fields.member, filter.path = message->metadata.fields.path; - for (size_t i = 0; i < 64; ++i) { + for (size_t i = 0; i < message->metadata.n_args; ++i) { if (message->metadata.args[i].element == 's') { filter.args[i] = message->metadata.args[i].value; filter.argpaths[i] = message->metadata.args[i].value; diff --git a/src/bus/peer.c b/src/bus/peer.c index cdd7aaa7..d9161660 100644 --- a/src/bus/peer.c +++ b/src/bus/peer.c @@ -773,7 +773,7 @@ int peer_broadcast(PolicySnapshot *sender_policy, NameSet *sender_names, MatchRe filter->member = message->metadata.fields.member, filter->path = message->metadata.fields.path; - for (size_t i = 0; i < 64; ++i) { + for (size_t i = 0; i < message->metadata.n_args; ++i) { if (message->metadata.args[i].element == 's') { filter->args[i] = message->metadata.args[i].value; filter->argpaths[i] = message->metadata.args[i].value; diff --git a/src/dbus/message.c b/src/dbus/message.c index 59b81078..3fd23a64 100644 --- a/src/dbus/message.c +++ b/src/dbus/message.c @@ -385,6 +385,7 @@ static int message_parse_body(Message *message, MessageMetadata *metadata) { if (i < C_ARRAY_SIZE(metadata->args)) { metadata->args[i].element = t->element; c_dvar_read(&v, (char[2]){ t->element, 0 }, &metadata->args[i].value); + metadata->n_args = i + 1; break; } diff --git a/src/dbus/message.h b/src/dbus/message.h index cc6cd60e..4125334b 100644 --- a/src/dbus/message.h +++ b/src/dbus/message.h @@ -56,6 +56,7 @@ struct MessageMetadata { char element; const void *value; } args[64]; + size_t n_args; }; struct Message {