[telepathy-mission-control/master] fd.o #21544: mcd-account-conditions: don't crash if the type is wrong when setting Condition
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue May 5 08:21:18 PDT 2009
Also, this probably ought to be validated according to the BNF in the
interface description, if anyone uses it.
---
src/mcd-account-conditions.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/mcd-account-conditions.c b/src/mcd-account-conditions.c
index d18d99d..20ce42b 100644
--- a/src/mcd-account-conditions.c
+++ b/src/mcd-account-conditions.c
@@ -64,6 +64,16 @@ set_condition (TpSvcDBusProperties *self, const gchar *name,
gchar **keys, **key;
GHashTable *conditions;
+ /* FIXME: some sort of validation beyond just the type? */
+
+ if (!G_VALUE_HOLDS (value, TP_HASH_TYPE_STRING_STRING_MAP))
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "Expected a{s:s} for Condition, but got %s",
+ G_VALUE_TYPE_NAME (value));
+ return FALSE;
+ }
+
keyfile = _mcd_account_get_keyfile (account);
unique_name = mcd_account_get_unique_name (account);
conditions = g_value_get_boxed (value);
--
1.5.6.5
More information about the telepathy-commits
mailing list