Using avahi 0.6.18 and SVN trunk I've found a crasher in avahi-daemon
easily triggerable from normal users using the dbus API, even using
python, by passing a TXT record with an empty string.
The problem is due to an assert() in avahi_string_list_add_arbitrary()
triggered by the NULL string even if the string size is set to 0.
This is the python code to trigger the bug:
#!/usr/bin/python
import dbus, avahi
bus = dbus.SystemBus()
server = bus.get_object(avahi.DBUS_NAME,
avahi.DBUS_PATH_SERVER,
avahi.DBUS_INTERFACE_SERVER)
entry = bus.get_object(avahi.DBUS_NAME,
server.EntryGroupNew(),
avahi.DBUS_INTERFACE_ENTRY_GROUP)
entry.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0),
"Hello World", "_presence._tcp", "", "",
dbus.UInt16(12345), [dbus.ByteArray("")])
entry.Commit()
Note the [dbus.ByteArray("")] passed to AddService which causes the problem.
I've attached a simple patch that skips the assert() if size is 0.
--
Buongiorno.
Complimenti per l'ottima scelta.
diff -r e3a91c1e5f63 avahi-common/strlst.c
--- a/avahi-common/strlst.c Mon May 14 11:26:02 2007 +0200
+++ b/avahi-common/strlst.c Tue May 15 11:05:29 2007 +0200
@@ -51,7 +51,8 @@ AvahiStringList *avahi_string_list_add_a
AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t*text, size_t size) {
AvahiStringList *n;
- assert(text);
+ if (size != 0)
+ assert(text);
if (!(n = avahi_string_list_add_anonymous(l, size)))
return NULL;
_______________________________________________
avahi mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/avahi