[Home]

Summary:ASTERISK-14236: [patch] XML parse errors related to buffer size, and not handled properly
Reporter:Simon Arlott (lp0)Labels:
Date Opened:2009-05-30 07:23:31Date Closed:2009-05-30 15:22:49
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_jabber
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 05302009_res_jabber.c.patch
( 1) jabber-roster-example.log
Description:I'm getting XML parse errors with a large roster. Decreasing the buffer from 4096 to 512 doesn't help but increasing it to 65536 helps (even although it's still split).

The connection should be dropped on an actual parse error (currently it just times out because it still thinks it's connecting).

****** ADDITIONAL INFORMATION ******

[ Output moved to jabber-roster-example.log and attached to issue. ]
Comments:By: Sean Bright (seanbright) 2009-05-30 11:33:26

Could you please apply the attached patch and test?  It won't fix the problem, but it will give me a better idea of where the problem is occurring.  Please enable debugging with:

   core set debug 10

And upload a full log of the session (an attachment to this issue, don't just copy/paste it into the notes).  You can either mask out the jids of your roster members with xxxxx as you did before or I can mark the issue private and you can upload the log without modification.

Thanks!



By: Simon Arlott (lp0) 2009-05-30 11:54:53

I can test it with that but not right now. I already checked the return value and it's IKS_BADXML.

By: Sean Bright (seanbright) 2009-05-30 11:56:30

Great, thanks.  Let me know when you are able to test with the patch.

By: Sean Bright (seanbright) 2009-05-30 14:23:25

I've updated the attached patch with a fix.  Could you please apply, make, make install, and test and report back your results?

Thanks.

By: Simon Arlott (lp0) 2009-05-30 14:58:07

With this patch and the original buffer size it works properly every time. (It was consistently failing every connection without it.)

By: Sean Bright (seanbright) 2009-05-30 15:02:32

Excellent.  Will commit.  Thanks for the report and the testing.

By: Digium Subversion (svnbot) 2009-05-30 15:11:34

Repository: asterisk
Revision: 198375

U   trunk/res/res_jabber.c

------------------------------------------------------------------------
r198375 | seanbright | 2009-05-30 15:11:34 -0500 (Sat, 30 May 2009) | 13 lines

Properly terminate the receive buffer before sending to iksemel.

aji_io_recv takes the maximum number of bytes to read (instead of the total
buffer size), so we have to subtract 1 from our buffer size.  Without this, when
we receive packets that are larger than our buffer, iksemel will choke and
things get wonky.

(closes issue ASTERISK-14236)
Reported by: lp0
Patches:
     05302009_res_jabber.c.patch uploaded by seanbright (license 71)
Tested by: seanbright, lp0

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=198375

By: Digium Subversion (svnbot) 2009-05-30 15:19:27

Repository: asterisk
Revision: 198384

_U  branches/1.6.0/
U   branches/1.6.0/res/res_jabber.c

------------------------------------------------------------------------
r198384 | seanbright | 2009-05-30 15:19:27 -0500 (Sat, 30 May 2009) | 20 lines

Merged revisions 198375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r198375 | seanbright | 2009-05-30 16:11:33 -0400 (Sat, 30 May 2009) | 13 lines
 
 Properly terminate the receive buffer before sending to iksemel.
 
 aji_io_recv takes the maximum number of bytes to read (instead of the total
 buffer size), so we have to subtract 1 from our buffer size.  Without this, when
 we receive packets that are larger than our buffer, iksemel will choke and
 things get wonky.
 
 (closes issue ASTERISK-14236)
 Reported by: lp0
 Patches:
       05302009_res_jabber.c.patch uploaded by seanbright (license 71)
 Tested by: seanbright, lp0
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=198384

By: Digium Subversion (svnbot) 2009-05-30 15:21:04

Repository: asterisk
Revision: 198390

_U  branches/1.6.1/
U   branches/1.6.1/res/res_jabber.c

------------------------------------------------------------------------
r198390 | seanbright | 2009-05-30 15:21:03 -0500 (Sat, 30 May 2009) | 20 lines

Merged revisions 198375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r198375 | seanbright | 2009-05-30 16:11:33 -0400 (Sat, 30 May 2009) | 13 lines
 
 Properly terminate the receive buffer before sending to iksemel.
 
 aji_io_recv takes the maximum number of bytes to read (instead of the total
 buffer size), so we have to subtract 1 from our buffer size.  Without this, when
 we receive packets that are larger than our buffer, iksemel will choke and
 things get wonky.
 
 (closes issue ASTERISK-14236)
 Reported by: lp0
 Patches:
       05302009_res_jabber.c.patch uploaded by seanbright (license 71)
 Tested by: seanbright, lp0
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=198390

By: Digium Subversion (svnbot) 2009-05-30 15:22:49

Repository: asterisk
Revision: 198397

_U  branches/1.6.2/
U   branches/1.6.2/res/res_jabber.c

------------------------------------------------------------------------
r198397 | seanbright | 2009-05-30 15:22:48 -0500 (Sat, 30 May 2009) | 20 lines

Merged revisions 198375 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r198375 | seanbright | 2009-05-30 16:11:33 -0400 (Sat, 30 May 2009) | 13 lines
 
 Properly terminate the receive buffer before sending to iksemel.
 
 aji_io_recv takes the maximum number of bytes to read (instead of the total
 buffer size), so we have to subtract 1 from our buffer size.  Without this, when
 we receive packets that are larger than our buffer, iksemel will choke and
 things get wonky.
 
 (closes issue ASTERISK-14236)
 Reported by: lp0
 Patches:
       05302009_res_jabber.c.patch uploaded by seanbright (license 71)
 Tested by: seanbright, lp0
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=198397