pidgin: 4dd6e066: Make the IRC "unknown message" debugging...

elb at pidgin.im elb at pidgin.im
Thu Jun 5 18:45:59 EDT 2008


-----------------------------------------------------------------
Revision: 4dd6e06680aebbca6a326930f5fff7e65ed87802
Ancestor: 904a276588f7de13ba13b578905c82c0493184ce
Author: elb at pidgin.im
Date: 2008-06-05T22:36:21
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4dd6e06680aebbca6a326930f5fff7e65ed87802

Modified files:
        libpurple/protocols/irc/msgs.c
        libpurple/protocols/irc/parse.c

ChangeLog: 

Make the IRC "unknown message" debugging messages UTF-8 safe.

Fixes #6019

-------------- next part --------------
============================================================
--- libpurple/protocols/irc/msgs.c	13ec164ae864a1248cefbd33c76b29da7a4f5419
+++ libpurple/protocols/irc/msgs.c	5cb77f0567315a4796fe1059a7bf58a1a9b27f16
@@ -122,7 +122,11 @@ void irc_msg_default(struct irc_conn *ir
 
 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)
============================================================
--- libpurple/protocols/irc/parse.c	45fbe577ecbf1bc34969294b7b9b0fbbe05d7957
+++ libpurple/protocols/irc/parse.c	1294e0e7cf82d5c3a2e7dbea2f89c499e88dcc13
@@ -710,5 +710,10 @@ static void irc_parse_error_cb(struct ir
 
 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);
 }


More information about the Commits mailing list