diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2007-04-03 18:53:25 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2007-04-03 18:53:25 +0000 |
commit | 54eabbe892f34d794daf990138480f98f84ea82f (patch) | |
tree | fdc440e0390aa9b73175c214516145d278448866 | |
parent | 3718730332bc295c324987b86cfa2c09585f84ec (diff) |
* 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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | dbus/dbus-address.c | 12 |
2 files changed, 19 insertions, 0 deletions
@@ -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 |