In SIPp 3.2 (and all earlier versions as far as I can tell), the XML
parser moves forward one character too far after parsing a comment,
DOCTYPE or CDATA, which can cause it not to recognise an XML element
which follows it immediately (i.e. without an intervening space or
newline). This is because the string pointer is moved forwards to just
after the '>' character, but the end of the xp_open_element function
also increments the pointer, and so skips a character.

In addition, the DOCTYPE parser moves forward one additional character
too far, which caused the bug originally reported. The attached patch
fixes both problems.

I also attach 1205629_repro_1.xml, which has a <scenario> tag
immediately following a comment, and 1205629_repro_2.xml, which has a
<scenario> tag separated from the <DOCTYPE> declaration by a single
newline. SIPp 3.2 will give the error "No 'scenario' section in xml
scenario file." for both files.

I'll check the patch in shortly if there are no objections, and try to
use the attached XML files as the basis of a regression test for this
bug.

Best,
Rob


Attachment: 1205629_repro_2.xml
Description: XML document

Index: xp_parser.c
===================================================================
--- xp_parser.c	(revision 600)
+++ xp_parser.c	(working copy)
@@ -218,17 +218,17 @@
           (strstr(ptr,"<![CDATA[") == ptr)) {
         char * cdata_end = strstr(ptr, "]]>");
         if(!cdata_end) return NULL;
-        ptr = cdata_end + 3;
+        ptr = cdata_end + 2;
       } else if ((*(ptr+1) == '!') && 
           (*(ptr+2) == '-') &&
           (strstr(ptr,"<!--") == ptr)) {
         char * comment_end = strstr(ptr, "-->");
         if(!comment_end) return NULL;
-        ptr = comment_end + 3;
+        ptr = comment_end + 2;
       } else if (strstr(ptr,"<!DOCTYPE") == ptr) {
         char * doctype_end = strstr(ptr, ">");
         if(!doctype_end) return NULL;
-        ptr = doctype_end + 2;
+        ptr = doctype_end;
       } else if(*(ptr+1) == '/') {
         level--;
         if(level < 0) return NULL;

Attachment: 1205629_repro_1.xml
Description: XML document

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to