dbus/dbus dbus-address.c,1.23,1.24

Ralf Habacker rhabacker at kemper.freedesktop.org
Tue Apr 3 11:53:27 PDT 2007


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv15624/dbus

Modified Files:
	dbus-address.c 
Log Message:
* dbus/dbus-address.c (dbus_parse_address): Do not accept zero-length address.
* dbus/dbus-address.c (_dbus_address_test): Add test for zero-length address.

Index: dbus-address.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-address.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- dbus-address.c	21 Oct 2006 18:51:30 -0000	1.23
+++ dbus-address.c	3 Apr 2007 18:53:25 -0000	1.24
@@ -376,6 +376,13 @@
   entries = NULL;
   pos = 0;
   len = _dbus_string_get_length (&str);
+
+  if (len == 0)
+  {
+    dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
+                    "Empty address '%s'", address);
+    goto error;
+  }
   
   while (pos < len)
     {
@@ -768,6 +775,11 @@
   dbus_address_entries_free (entries);
 
   /* Different possible errors */
+  if (dbus_parse_address ("", &entries, &len, &error))
+    _dbus_assert_not_reached ("Parsed incorrect address.");
+  else
+    dbus_error_free (&error);
+
   if (dbus_parse_address ("foo", &entries, &len, &error))
     _dbus_assert_not_reached ("Parsed incorrect address.");
   else



More information about the dbus-commit mailing list