pidgin: d879d223: Drop and then recover from XML messages ...

evands at pidgin.im evands at pidgin.im
Fri Jul 4 12:20:54 EDT 2008


-----------------------------------------------------------------
Revision: d879d22351a06d6edbf90dada7a8c3e289f28653
Ancestor: d1579a89f3bf59ddffcf9c254872e7c52f2332cd
Author: evands at pidgin.im
Date: 2008-07-04T16:14:35
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d879d22351a06d6edbf90dada7a8c3e289f28653

Modified files:
        libpurple/protocols/jabber/parser.c

ChangeLog: 

Drop and then recover from XML messages which trigger invalid character
errors rather than disconnecting.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/parser.c	71536a473b0ca2278d5cc9e4f9e3e12835628c36
+++ libpurple/protocols/jabber/parser.c	2a98be9e62c6dbe0d16c84640739b85ae93e7ab7
@@ -209,9 +209,15 @@ void jabber_parser_process(JabberStream 
 	} else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) {
 		purple_debug_error("jabber", "xmlParseChunk returned error %i", ret);
 
-		purple_connection_error_reason (js->gc,
-			PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
-			_("XML Parse error"));
+		if ((ret >= XML_ERR_INVALID_HEX_CHARREF) && (ret <= XML_ERR_INVALID_CHAR)) {
+			/* If the error involves an invalid character, just drop this message.
+			 * We'll create a new parser next time it's needed. */
+			jabber_parser_free(js);
+		} else {
+			purple_connection_error_reason (js->gc,
+				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+				_("XML Parse error"));
+		}
 	}
 }
 


More information about the Commits mailing list