diff options
author | Nick Schermer <nick@xfce.org> | 2012-04-01 18:01:14 +0200 |
---|---|---|
committer | Nick Schermer <nick@xfce.org> | 2012-04-01 18:08:46 +0200 |
commit | 84e4df3e0703fc4487a2996f0e2db569776e620e (patch) | |
tree | 21d14f290bf1cbe62b2633e12b91ee714e40487a /xfconf | |
parent | dceb415dadda97b0d2cba7784603ff7c1c731484 (diff) | |
download | xfconf-84e4df3e0703fc4487a2996f0e2db569776e620e.tar.gz |
UTF-8 check xfconf strings.
DBus messages need to be utf-8 valid, resulting in strange aborts
when this is not the case. Better break early.
Diffstat (limited to 'xfconf')
-rw-r--r-- | xfconf/xfconf-channel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/xfconf/xfconf-channel.c b/xfconf/xfconf-channel.c index 01ecd7c..5539707 100644 --- a/xfconf/xfconf-channel.c +++ b/xfconf/xfconf-channel.c @@ -1018,7 +1018,8 @@ xfconf_channel_set_string(XfconfChannel *channel, GValue val = { 0, }; gboolean ret; - g_return_val_if_fail(XFCONF_IS_CHANNEL(channel) && property && value, FALSE); + g_return_val_if_fail(XFCONF_IS_CHANNEL(channel) && property, FALSE); + g_return_val_if_fail(g_utf8_validate(value, -1, NULL), FALSE); g_value_init(&val, G_TYPE_STRING); g_value_set_static_string(&val, value); @@ -1320,7 +1321,11 @@ xfconf_channel_set_property(XfconfChannel *channel, GPtrArray *arr_new = NULL; gboolean ret; - g_return_val_if_fail(XFCONF_IS_CHANNEL(channel) && property && value, + g_return_val_if_fail(XFCONF_IS_CHANNEL(channel) + && property + && G_IS_VALUE(value), FALSE); + g_return_val_if_fail(!G_VALUE_HOLDS_STRING(value) + || g_utf8_validate(g_value_get_string(value), -1, NULL), FALSE); /* intercept uint16/int16 since dbus-glib doesn't know how to send |