# HG changeset patch # User Ethan Blanton # Date 1212705381 0 # Node ID 106a912f1ef52692c1b8d70236f0b3f941a5b881 # Parent 48aea903d270c817f57913feaa1f989874b3f95d Make the IRC "unknown message" debugging messages UTF-8 safe. Fixes #6019 diff -r 48aea903d270 -r 106a912f1ef5 libpurple/protocols/irc/msgs.c --- a/libpurple/protocols/irc/msgs.c Thu Jun 05 12:25:20 2008 +0000 +++ b/libpurple/protocols/irc/msgs.c Thu Jun 05 22:36:21 2008 +0000 @@ -122,7 +122,11 @@ void irc_msg_default(struct irc_conn *irc, const char *name, const char *from, char **args) { - purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", args[0]); + char *clean; + /* This, too, should be escaped somehow (smarter) */ + clean = purple_utf8_salvage(args[0]); + purple_debug(PURPLE_DEBUG_INFO, "irc", "Unrecognized message: %s\n", clean); + g_free(clean); } void irc_msg_features(struct irc_conn *irc, const char *name, const char *from, char **args) diff -r 48aea903d270 -r 106a912f1ef5 libpurple/protocols/irc/parse.c --- a/libpurple/protocols/irc/parse.c Thu Jun 05 12:25:20 2008 +0000 +++ b/libpurple/protocols/irc/parse.c Thu Jun 05 22:36:21 2008 +0000 @@ -710,5 +710,10 @@ static void irc_parse_error_cb(struct irc_conn *irc, char *input) { - purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", input); + char *clean; + /* This really should be escaped somehow that you can tell what + * the junk was -- but as it is, it can crash glib. */ + clean = purple_utf8_salvage(input); + purple_debug(PURPLE_DEBUG_WARNING, "irc", "Unrecognized string: %s\n", clean); + g_free(clean); }