Mercurial > pidgin.yaz
changeset 14939:06ae7ffc47e3
[gaim-migrate @ 17711]
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.
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 09 Nov 2006 16:35:06 +0000 |
parents | 4b2ac755d565 |
children | 28c7e23bcc7e |
files | libgaim/dbus-server.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libgaim/dbus-server.c Thu Nov 09 05:45:55 2006 +0000 +++ b/libgaim/dbus-server.c Thu Nov 09 16:35:06 2006 +0000 @@ -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: