[Expat-checkins] expat/lib xmlparse.c,1.132,1.133

Karl Waclawek kwaclaw at users.sourceforge.net
Sun May 2 13:31:15 EDT 2004


Update of /cvsroot/expat/expat/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24606

Modified Files:
	xmlparse.c 
Log Message:
Fix for  bug #946506: PublicId for DOCTYPE not checked & normalized.


Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- xmlparse.c	29 Apr 2004 17:53:34 -0000	1.132
+++ xmlparse.c	2 May 2004 17:31:13 -0000	1.133
@@ -3675,28 +3675,31 @@
     case XML_ROLE_DOCTYPE_PUBLIC_ID:
 #ifdef XML_DTD
       useForeignDTD = XML_FALSE;
+      declEntity = (ENTITY *)lookup(&dtd->paramEntities,
+                                    externalSubsetName,
+                                    sizeof(ENTITY));
+      if (!declEntity)
+        return XML_ERROR_NO_MEMORY;
 #endif /* XML_DTD */
       dtd->hasParamEntityRefs = XML_TRUE;
       if (startDoctypeDeclHandler) {
+        if (!XmlIsPublicId(enc, s, next, eventPP))
+          return XML_ERROR_SYNTAX;
         doctypePubid = poolStoreString(&tempPool, enc,
                                        s + enc->minBytesPerChar,
                                        next - enc->minBytesPerChar);
         if (!doctypePubid)
           return XML_ERROR_NO_MEMORY;
+        normalizePublicId((XML_Char *)doctypePubid);
         poolFinish(&tempPool);
         handleDefault = XML_FALSE;
+        goto alreadyChecked;
       }
-#ifdef XML_DTD
-      declEntity = (ENTITY *)lookup(&dtd->paramEntities,
-                                    externalSubsetName,
-                                    sizeof(ENTITY));
-      if (!declEntity)
-        return XML_ERROR_NO_MEMORY;
-#endif /* XML_DTD */
       /* fall through */
     case XML_ROLE_ENTITY_PUBLIC_ID:
       if (!XmlIsPublicId(enc, s, next, eventPP))
         return XML_ERROR_SYNTAX;
+    alreadyChecked:
       if (dtd->keepProcessing && declEntity) {
         XML_Char *tem = poolStoreString(&dtd->pool,
                                         enc,




More information about the Expat-checkins mailing list