[Xfce4-commits] <xfconf:master> UTF-8 check xfconf strings.
Nick Schermer
noreply at xfce.org
Sun Apr 1 18:12:02 CEST 2012
Updating branch refs/heads/master
to 84e4df3e0703fc4487a2996f0e2db569776e620e (commit)
from dceb415dadda97b0d2cba7784603ff7c1c731484 (commit)
commit 84e4df3e0703fc4487a2996f0e2db569776e620e
Author: Nick Schermer <nick at xfce.org>
Date: Sun Apr 1 18:01:14 2012 +0200
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.
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
More information about the Xfce4-commits
mailing list