Revision: 17711
http://svn.sourceforge.net/gaim/?rev=17711&view=rev
Author: eblanton
Date: 2006-11-09 08:35:06 -0800 (Thu, 09 Nov 2006)
Log Message:
-----------
This should prevent D-BUS from having to deal with any non-UTF-8
strings emitted by Gaim signals, which should therefore prevent its
early exit. Strings will be salvaged via gaim_utf8_salvage before
emission, and an error will be logged. IRC (and any other protocols
spitting out invalid UTF-8 to signals) should yet be fixed to emit
some sort of binary blob, rather than a UTF-8 string, but this will
make D-BUS robust to any future transgressions.
This is completely untested.
Modified Paths:
--------------
trunk/libgaim/dbus-server.c
Modified: trunk/libgaim/dbus-server.c
===================================================================
--- trunk/libgaim/dbus-server.c 2006-11-09 05:45:55 UTC (rev 17710)
+++ trunk/libgaim/dbus-server.c 2006-11-09 16:35:06 UTC (rev 17711)
@@ -38,6 +38,7 @@
#include "core.h"
#include "internal.h"
#include "savedstatuses.h"
+#include "util.h"
#include "value.h"
#include "xmlnode.h"
@@ -667,6 +668,7 @@
guint xuint;
gboolean xboolean;
gpointer ptr = NULL;
+ gboolean allocated = FALSE;
if (gaim_value_is_outgoing(gaim_values[i]))
{
@@ -690,7 +692,14 @@
break;
case GAIM_TYPE_STRING:
str = null_to_empty(my_arg(char*));
+ if (!g_utf8_validate(str, -1, NULL)) {
+ gaim_debug_error("dbus", "Invalid UTF-8 string passed to signal, emitting salvaged string!\n");
+ str = gaim_utf8_salvage(str);
+ allocated = TRUE;
+ }
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &str);
+ if (allocated)
+ g_free(str);
break;
case GAIM_TYPE_SUBTYPE: /* registered pointers only! */
case GAIM_TYPE_POINTER:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|