]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Bug 17803 - Fix both test case and validation logic
authorColin Walters <walters@verbum.org>
Wed, 1 Apr 2009 16:02:00 +0000 (12:02 -0400)
committerColin Walters <walters@verbum.org>
Wed, 6 May 2009 16:51:16 +0000 (12:51 -0400)
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.

dbus/dbus-marshal-validate-util.c
dbus/dbus-marshal-validate.c

index 5365d6d3517fddc9a110201a5d4c5aa002854327..ac901c38b671e56e16fa3f55be2702c9f708b22f 100644 (file)
@@ -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 */
   };
 
index 35998cbb21a5be3d26d6e4ef9d7d03c3938c50bb..ee955485c8565c51f37a118dd588a6fb123dfc7c 100644 (file)
@@ -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;
     }