dbus: Increase buffer size to fix Introspect XML
authorJouni Malinen <j@w1.fi>
Sat, 31 Dec 2011 15:40:49 +0000 (17:40 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 31 Dec 2011 15:40:49 +0000 (17:40 +0200)
Commit e9c3c1afedd2d0c6a0939f40c40701af8c450e1f added a new D-Bus
method and that was enough to push the Introspect XML buffer over
the previously allocated 8000 bytes. Increase the buffer size to
make enough room for P2P interface. In addition, add a debug
message to indicate if an XML segment does not fit into the buffer
to make this types of failures somewhat easier to catch.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/dbus/dbus_new_introspect.c

index fb29f20..d443269 100644 (file)
@@ -164,6 +164,12 @@ static void add_interfaces(struct dl_list *list, struct wpabuf *xml)
                if (wpabuf_len(iface->xml) + 20 < wpabuf_tailroom(xml)) {
                        wpabuf_put_buf(xml, iface->xml);
                        wpabuf_put_str(xml, "</interface>");
+               } else {
+                       wpa_printf(MSG_DEBUG, "dbus: Not enough room for "
+                                  "add_interfaces inspect data: tailroom %u, "
+                                  "add %u",
+                                  (unsigned int) wpabuf_tailroom(xml),
+                                  (unsigned int) wpabuf_len(iface->xml));
                }
                dl_list_del(&iface->list);
                wpabuf_free(iface->xml);
@@ -251,7 +257,7 @@ DBusMessage * wpa_dbus_introspect(DBusMessage *message,
        DBusMessage *reply;
        struct wpabuf *xml;
 
-       xml = wpabuf_alloc(8000);
+       xml = wpabuf_alloc(10000);
        if (xml == NULL)
                return NULL;