From b5daab9d464d239b0bf24379c6472ba09af35f66 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 21 May 2007 17:13:05 +0000 Subject: [PATCH] fix a local DoS (by hitting an assert) when passing empty TXT strings to the avahi-daemon for regsitration. (Problem identified and original patch supplied by Emanuele Aina) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1482 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-common/strlst.c | 2 +- avahi-daemon/dbus-util.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/avahi-common/strlst.c b/avahi-common/strlst.c index c6ceb0f..9ffa18e 100644 --- a/avahi-common/strlst.c +++ b/avahi-common/strlst.c @@ -51,7 +51,7 @@ AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size) AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t*text, size_t size) { AvahiStringList *n; - assert(text); + assert(size == 0 || text); if (!(n = avahi_string_list_add_anonymous(l, size))) return NULL; diff --git a/avahi-daemon/dbus-util.c b/avahi-daemon/dbus-util.c index d1a7a20..ca08d7b 100644 --- a/avahi-daemon/dbus-util.c +++ b/avahi-daemon/dbus-util.c @@ -344,6 +344,9 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) { k = (const uint8_t*) ""; n = 0; dbus_message_iter_get_fixed_array(&sub2, &k, &n); + + if (!k) + k = (const uint8_t*) ""; strlst = avahi_string_list_add_arbitrary(strlst, k, n); -- 2.39.5