diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-05-05 16:20:29 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-05-05 17:10:01 +0100 |
commit | 246f591839f56566daeef0b7e766007519219f9a (patch) | |
tree | 508c4e84693938c73ba3225a5fd48f4671e5592d /src/mcd-account-compat.c | |
parent | fb280d32c940be9687659a2ed97f990601ea5522 (diff) |
fd.o #21544: mcd-account-compat: don't crash if properties are set to wrong types
Also add a FIXME note: we should probably do more validation in both cases,
but I don't know what the semantics of these fields are meant to be.
Diffstat (limited to 'src/mcd-account-compat.c')
-rw-r--r-- | src/mcd-account-compat.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c index 55817038..70c7ae5f 100644 --- a/src/mcd-account-compat.c +++ b/src/mcd-account-compat.c @@ -60,6 +60,17 @@ set_profile (TpSvcDBusProperties *self, const gchar *name, const gchar *string, *unique_name; GKeyFile *keyfile; + if (!G_VALUE_HOLDS_STRING (value)) + { + g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Expected string for Profile, but got %s", + G_VALUE_TYPE_NAME (value)); + return FALSE; + } + + /* FIXME: should we reject profile changes after account creation? */ + /* FIXME: some sort of validation beyond just the type? */ + keyfile = _mcd_account_get_keyfile (account); unique_name = mcd_account_get_unique_name (account); string = g_value_get_string (value); @@ -113,6 +124,16 @@ set_secondary_vcard_fields (TpSvcDBusProperties *self, const gchar *name, const gchar *unique_name, **fields, **field; GKeyFile *keyfile; + /* FIXME: some sort of validation beyond just the type? */ + + if (!G_VALUE_HOLDS (value, G_TYPE_STRV)) + { + g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Expected string-array for SecondaryVCardFields, but " + "got %s", G_VALUE_TYPE_NAME (value)); + return FALSE; + } + keyfile = _mcd_account_get_keyfile (account); unique_name = mcd_account_get_unique_name (account); fields = g_value_get_boxed (value); |