From 88b84af7e3fe41a46ddf8ef39cd3b2f90369fc5e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 25 Aug 2005 19:34:51 +0000 Subject: [PATCH] * fix "sebest's bug" (TM) -- deal with dbus brokeness when passing zero length arrays git-svn-id: file:///home/lennart/svn/public/avahi/trunk@446 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-client/resolver.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/avahi-client/resolver.c b/avahi-client/resolver.c index 66208cf..f23f9d7 100644 --- a/avahi-client/resolver.c +++ b/avahi-client/resolver.c @@ -93,8 +93,7 @@ static void pending_call_callback(DBusPendingCall *pending, void *userdata) { for (;;) { DBusMessageIter sub2; - int at, n; - uint8_t *k; + int at; if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID) break; @@ -107,8 +106,14 @@ static void pending_call_callback(DBusPendingCall *pending, void *userdata) { } dbus_message_iter_recurse(&sub, &sub2); - dbus_message_iter_get_fixed_array(&sub2, &k, &n); - strlst = avahi_string_list_add_arbitrary(strlst, k, n); + + if (dbus_message_iter_get_array_len(&sub2) > 0) { + uint8_t *k; + int n; + + dbus_message_iter_get_fixed_array(&sub2, &k, &n); + strlst = avahi_string_list_add_arbitrary(strlst, k, n); + } dbus_message_iter_next(&sub); } -- 2.39.5