2009-08-04 Mark Doffman <mark.doffman@codethink.co.uk>
authorMark Doffman <mdoff@altair-voyager.(none)>
Tue, 4 Aug 2009 18:18:19 +0000 (19:18 +0100)
committerMark Doffman <mdoff@altair-voyager.(none)>
Tue, 4 Aug 2009 18:18:19 +0000 (19:18 +0100)
        Modify the incorrect use of dbind_emit_signal_va.
        Check for NULL args in dbind_marshall_any.

        Fix for bug:
                http://bugs.freedesktop.org/show_bug.cgi?id=23027

dbind/dbind-any.c
registryd/registry.c

index 0d0ecf9..79a8832 100644 (file)
@@ -351,6 +351,13 @@ dbind_any_marshal_va (DBusMessageIter *iter,
                       va_list          args)
 {
     char *p = *arg_types;
+
+    /* Guard against null arg types 
+       Fix for - http://bugs.freedesktop.org/show_bug.cgi?id=23027
+     */
+    if (p == NULL)
+        p = "";
+
     {
         /* special case base-types since we need to walk the stack worse-luck */
         for (;*p != '\0' && *p != '=';) {
index 8a3d8f0..a726559 100644 (file)
@@ -54,12 +54,12 @@ spi_registry_init (SpiRegistry *registry)
 
 /*---------------------------------------------------------------------------*/
 
-static void emit(SpiRegistry *reg, const char *itf, const char *name, int ftype, ...)
+static void emit(SpiRegistry *reg, const char *itf, const char *name, const char *arg_types, ...)
 {
   va_list arg;
 
-  va_start(arg, ftype);
-  dbind_emit_signal_va (reg->bus, SPI_DBUS_PATH_REGISTRY, itf, name, NULL, ftype, arg);
+  va_start(arg, arg_types);
+  dbind_emit_signal_va (reg->bus, SPI_DBUS_PATH_REGISTRY, itf, name, NULL, arg_types, arg);
   va_end(arg);
 }
 
@@ -131,11 +131,10 @@ add_application (DBusConnection *bus, SpiRegistry *reg, gchar *app)
       emit (reg,
             SPI_DBUS_INTERFACE_REGISTRY,
             "updateApplications",
-            DBUS_TYPE_INT32,
+            "is",
             &add,
-            DBUS_TYPE_STRING,
-            &app,
-            DBUS_TYPE_INVALID);
+            &app
+           );
     }
 }
 
@@ -150,11 +149,10 @@ remove_application (DBusConnection *bus, SpiRegistry *reg, gchar *app)
       emit (reg,
             SPI_DBUS_INTERFACE_REGISTRY,
             "updateApplications",
-            DBUS_TYPE_INT32,
+            "is",
             &remove,
-            DBUS_TYPE_STRING,
-            &app,
-            DBUS_TYPE_INVALID);
+            &app
+           );
     }
 }