summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-04-01 12:02:00 -0400
committerColin Walters <walters@verbum.org>2009-04-17 13:25:39 -0400
commite8f8c1c5a2bddfbf43c168323c9c9fd78f51a643 (patch)
treee726f50fa27e03dde3479619cceea75db1b57906 /dbus
parent8f5c3e3c25901b089bc3fb87d53c7a98df48121f (diff)
Bug 17803 - Fix both test case and validation logic
The previous commit had errors in both the test case and the validation logic. The test case was missing a trailing comma before the previous one, so we weren't testing the signature we thought we were. The validation logic was wrong because if the type was not valid, we'd drop through the entire if clause, and thus skip returning an error code, and accept the signature.
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-marshal-validate-util.c2
-rw-r--r--dbus/dbus-marshal-validate.c13
2 files changed, 8 insertions, 7 deletions
diff --git a/dbus/dbus-marshal-validate-util.c b/dbus/dbus-marshal-validate-util.c
index 5365d6d3..ac901c38 100644
--- a/dbus/dbus-marshal-validate-util.c
+++ b/dbus/dbus-marshal-validate-util.c
@@ -227,7 +227,7 @@ _dbus_marshal_validate_test (void)
"not a valid signature",
"123",
".",
- "("
+ "(",
"a{(ii)i}" /* https://bugs.freedesktop.org/show_bug.cgi?id=17803 */
};
diff --git a/dbus/dbus-marshal-validate.c b/dbus/dbus-marshal-validate.c
index 35998cbb..ee955485 100644
--- a/dbus/dbus-marshal-validate.c
+++ b/dbus/dbus-marshal-validate.c
@@ -246,14 +246,15 @@ _dbus_validate_signature_with_reason (const DBusString *type_str,
}
}
- if (last == DBUS_DICT_ENTRY_BEGIN_CHAR &&
- _dbus_type_is_valid (*p) &&
- !dbus_type_is_basic (*p))
+ if (last == DBUS_DICT_ENTRY_BEGIN_CHAR)
{
- result = DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
- goto out;
+ if (!(_dbus_type_is_valid (*p) && dbus_type_is_basic (*p)))
+ {
+ result = DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE;
+ goto out;
+ }
}
-
+
last = *p;
++p;
}