From 9f000c5d9f4f656d60a4b5f6d3089c182b02143a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 28 Mar 2011 17:21:18 +0100 Subject: [PATCH 10/25] marshal_signature: check validity of the signature Also remove a spurious cast, and comment why we're *not* assuming that failure here is necessarily OOM. --- dbus/dbus-gvalue.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/dbus/dbus-gvalue.c b/dbus/dbus-gvalue.c index db84472..7293981 100644 --- a/dbus/dbus-gvalue.c +++ b/dbus/dbus-gvalue.c @@ -1614,8 +1614,11 @@ marshal_signature (DBusMessageIter *iter, g_assert (G_VALUE_TYPE (value) == DBUS_TYPE_G_SIGNATURE); - sig = (const char*) g_value_get_boxed (value); + sig = g_value_get_boxed (value); + g_return_val_if_fail (g_variant_is_signature (sig), FALSE); + /* failure here isn't strictly *guaranteed* to be OOM, since GDBus might + * understand more type-codes than our libdbus */ if (!dbus_message_iter_append_basic (iter, DBUS_TYPE_SIGNATURE, &sig)) -- 1.7.4.1