[systemd-commits] src/libsystemd-bus

Kay Sievers kay at kemper.freedesktop.org
Wed Dec 18 21:57:14 PST 2013


 src/libsystemd-bus/bus-control.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 8da4de037650c87362285055d2987614e0a46302
Author: Kay Sievers <kay at vrfy.org>
Date:   Thu Dec 19 06:55:44 2013 +0100

    bus: do not add empty strings, size should be 0

diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index b8f6360..5540d85 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -775,12 +775,12 @@ static int add_name_change_match(sd_bus *bus,
                  * name, then add KDBUS_MATCH_NAME_{ADD,REMOVE,CHANGE}
                  * matches for it */
 
-                l = name ? strlen(name) : 0;
+                l = name ? strlen(name) + 1 : 0;
 
                 sz = ALIGN8(offsetof(struct kdbus_cmd_match, items) +
                             offsetof(struct kdbus_item, name_change) +
                             offsetof(struct kdbus_notify_name_change, name) +
-                            l+1);
+                            l);
 
                 m = alloca0(sz);
                 m->size = sz;
@@ -791,7 +791,7 @@ static int add_name_change_match(sd_bus *bus,
                 item->size =
                         offsetof(struct kdbus_item, name_change) +
                         offsetof(struct kdbus_notify_name_change, name) +
-                        l+1;
+                        l;
 
                 item->name_change.old.id = old_owner_id;
                 item->name_change.new.id = new_owner_id;



More information about the systemd-commits mailing list