From 63638106fa8b9fa81c83bd152563e411c27cc996 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 1 Jan 2006 14:16:50 +0000 Subject: [PATCH] workaround DBUS limitation which caused an assert() to fail when passing string lists with empty strings git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1049 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/dbus-util.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/avahi-daemon/dbus-util.c b/avahi-daemon/dbus-util.c index 76a6b73..c9ef949 100644 --- a/avahi-daemon/dbus-util.c +++ b/avahi-daemon/dbus-util.c @@ -327,9 +327,9 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) { dbus_message_iter_recurse(&iter, &sub); for (;;) { - DBusMessageIter sub2; int at, n; - uint8_t *k; + const uint8_t *k; + DBusMessageIter sub2; if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID) break; @@ -340,7 +340,14 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) { goto fail; dbus_message_iter_recurse(&sub, &sub2); - dbus_message_iter_get_fixed_array(&sub2, &k, &n); + + if (dbus_message_iter_get_array_len(&sub2) > 0) + dbus_message_iter_get_fixed_array(&sub2, &k, &n); + else { + k = (const uint8_t*) ""; + n = 0; + } + strlst = avahi_string_list_add_arbitrary(strlst, k, n); dbus_message_iter_next(&sub); -- 2.39.5