From: Mike Gorse Date: Mon, 16 May 2011 20:56:25 +0000 (-0500) Subject: Check table description strings for valid UTF-8 X-Git-Tag: AT_SPI2_ATK_2_12_0~216 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git;a=commitdiff_plain;h=7540b8404de04eca32735fec3482b9b42d1e432f Check table description strings for valid UTF-8 --- diff --git a/atk-adaptor/adaptors/table-adaptor.c b/atk-adaptor/adaptors/table-adaptor.c index 59d45e8..f296816 100644 --- a/atk-adaptor/adaptors/table-adaptor.c +++ b/atk-adaptor/adaptors/table-adaptor.c @@ -199,6 +199,19 @@ impl_GetColumnAtIndex (DBusConnection * bus, DBusMessage * message, return reply; } +static gchar * +validate_unallocated_string (gchar *str) +{ + if (!str) + return ""; + if (!g_utf8_validate (str, -1, NULL)) + { + g_warning ("atk-bridge: received bad UTF-8 string from a table function"); + return ""; + } + return str; +} + static DBusMessage * impl_GetRowDescription (DBusConnection * bus, DBusMessage * message, void *user_data) @@ -218,8 +231,7 @@ impl_GetRowDescription (DBusConnection * bus, DBusMessage * message, return droute_invalid_arguments_error (message); } description = atk_table_get_row_description (table, row); - if (!description) - description = ""; + description = validate_unallocated_string (description); reply = dbus_message_new_method_return (message); if (reply) { @@ -248,8 +260,7 @@ impl_GetColumnDescription (DBusConnection * bus, DBusMessage * message, return droute_invalid_arguments_error (message); } description = atk_table_get_column_description (table, column); - if (!description) - description = ""; + description = validate_unallocated_string (description); reply = dbus_message_new_method_return (message); if (reply) {