[Pidgin] #6031: ASCII control characters cause problems with libpurple clients

Pidgin trac at pidgin.im
Wed Jun 11 12:35:00 EDT 2008


#6031: ASCII control characters cause problems with libpurple clients
---------------------+------------------------------------------------------
  Reporter:  dhawes  |       Owner:  nwalp
      Type:  defect  |      Status:  new  
  Priority:  minor   |   Milestone:       
 Component:  XMPP    |     Version:  2.4.2
Resolution:          |    Keywords:       
   Pending:  0       |  
---------------------+------------------------------------------------------
Comment (by dhawes):

 In xmlParseChunk, the control characters cause the xmlParserError
 XML_ERR_INVALID_CHAR /* 9 */, and the xmlParserCtxt (js->context) has its
 errNo set to 9 and disableSAX is set to 1.

 On subsequent calls to xmlParseChunk, no action will be taken since there
 is an errNo and disableSAX is set to 1.  It seems that after a period of
 time the connection will time out since no more XML messages from the
 server can be parsed.

 I'm not quite sure what the proper thing to do in this case is, but it
 seems that the errNo in js->context should be checked and some action
 should be taken (create new context, reset context, shutdown?).

 The following patch, though I do not think it is the proper solution, will
 allow the control characters to be discarded and the client will still be
 able to send and receive messages:


 {{{
 diff -ur pidgin-2.4.2/libpurple/protocols/jabber/parser.c
 pidgin-2.4.2-patch/libpurple/protocols/jabber/parser.c
 --- pidgin-2.4.2/libpurple/protocols/jabber/parser.c    2008-05-12
 15:07:44.000000000 -0400
 +++ pidgin-2.4.2-patch/libpurple/protocols/jabber/parser.c  2008-06-11
 10:57:29.000000000 -0400
 @@ -197,5 +197,12 @@
             PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
             _("XML Parse error"));
     }
 +    if(js->context != NULL && js->context->errNo != XML_ERR_OK) {
 +        do {
 +            js->context->errNo = 0;
 +            js->context->disableSAX = 0;
 +        }
 +        while(xmlParseChunk(js->context, "", 0, 0) > 0);
 +    }
  }

 }}}

-- 
Ticket URL: <http://developer.pidgin.im/ticket/6031#comment:2>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list