expat/lib xmltok_impl.c,1.5,1.6 xmlparse.c,1.81,1.82

"Karl Waclawek" <[email protected]>
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6344

Modified Files:
	xmltok_impl.c xmlparse.c 
Log Message:
Fix bug reported by Rolf Ade:
CR at end of buffer in epilog causes memory access violation.

Index: xmltok_impl.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmltok_impl.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- xmltok_impl.c	25 Jul 2002 14:51:19 -0000	1.5
+++ xmltok_impl.c	30 Aug 2002 23:22:20 -0000	1.6
@@ -1009,8 +1009,10 @@
       return XML_TOK_INVALID;
     }
   case BT_CR:
-    if (ptr + MINBPC(enc) == end)
+    if (ptr + MINBPC(enc) == end) {
+      *nextTokPtr = end;
       return -XML_TOK_PROLOG_S;
+    }
     /* fall through */
   case BT_S: case BT_LF:
     for (;;) {

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- xmlparse.c	29 Aug 2002 04:54:04 -0000	1.81
+++ xmlparse.c	30 Aug 2002 23:22:20 -0000	1.82
@@ -4024,13 +4024,15 @@
     switch (tok) {
     case -XML_TOK_PROLOG_S:
       if (defaultHandler) {
-        eventEndPtr = end;
-        reportDefault(parser, encoding, s, end);
+        eventEndPtr = next;
+        reportDefault(parser, encoding, s, next);
       }
-      /* fall through */
+      if (nextPtr)
+        *nextPtr = next;
+      return XML_ERROR_NONE;
     case XML_TOK_NONE:
       if (nextPtr)
-        *nextPtr = end;
+        *nextPtr = s;
       return XML_ERROR_NONE;
     case XML_TOK_PROLOG_S:
       if (defaultHandler)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.