summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--dbus/dbus-address.c12
2 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f36008b7..bc0f782a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-03 Timo Hoenig <thoenig@suse.de>
+
+ * 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.
+
2007-03-25 Ralf.Habacker <ralf.habacker@freenet.de>
* cmake/dbus/CMakeLists.txt: debug postfix also for mingw.
diff --git a/dbus/dbus-address.c b/dbus/dbus-address.c
index bb2a5899..b6bb36d2 100644
--- a/dbus/dbus-address.c
+++ b/dbus/dbus-address.c
@@ -376,6 +376,13 @@ dbus_parse_address (const char *address,
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_test (void)
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