summaryrefslogtreecommitdiff
path: root/droute
diff options
context:
space:
mode:
authorMike Gorse <mgorse@novell.com>2011-05-16 15:20:21 -0500
committerMike Gorse <mgorse@novell.com>2011-05-16 15:20:21 -0500
commitb5351fa1d360751dd6fb40251cfa8664837613fb (patch)
treedbdb54203d2c0a4babf3e6b1ca86f11dfd299447 /droute
parent7145810bfe4c194cf36d0ee208375ad3fb189be9 (diff)
downloadat-spi2-atk-b5351fa1d360751dd6fb40251cfa8664837613fb.tar.gz
BGO#650286: Ensure valid UTF-8 from ATK
When we receive strings from atk, we should ensure that they are valid UTF-8 before sending them over D-Bus, since bad UTF-8 will cause dbus-daemon to kill the connection.
Diffstat (limited to 'droute')
-rw-r--r--droute/droute-variant.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/droute/droute-variant.c b/droute/droute-variant.c
index d4b5ca6..bd5ef36 100644
--- a/droute/droute-variant.c
+++ b/droute/droute-variant.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
+#include "glib.h"
#include "droute-variant.h"
@@ -64,6 +65,12 @@ droute_return_v_string (DBusMessageIter *iter, const char *val)
if (!val)
val = "";
+ if (!g_utf8_validate (val, -1, NULL))
+ {
+ g_warning ("droute: Received bad UTF-8 string");
+ val = "";
+ }
+
if (!dbus_message_iter_open_container
(iter, DBUS_TYPE_VARIANT, DBUS_TYPE_STRING_AS_STRING, &sub))
{