mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-08 06:48:01 +02:00
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.
This commit is contained in:
parent
b2f943e9c0
commit
b5a1f3c54a
2 changed files with 8 additions and 7 deletions
|
|
@ -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 */
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue