aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-10-14 11:15:18 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-10-14 11:15:18 +0000
commit819d5cb84d8cf91432f76b43612b710e91c19d11 (patch)
treeda79bea09777b0ce2e70eeba02fc579db41878ba
parent6045c90aefe11086aaf504415811f97f87e6f967 (diff)
downloadandroid_external_libxml2-819d5cb84d8cf91432f76b43612b710e91c19d11.tar.gz
android_external_libxml2-819d5cb84d8cf91432f76b43612b710e91c19d11.tar.bz2
android_external_libxml2-819d5cb84d8cf91432f76b43612b710e91c19d11.zip
Christian Glahn found a small bug in the push parser. cleaned up and made
* parser.c: Christian Glahn found a small bug in the push parser. * xmlIO.c include/libxml/xmlIO.h: cleaned up and made xmlCheckFilename public Daniel
-rw-r--r--ChangeLog6
-rw-r--r--include/libxml/xmlIO.h1
-rw-r--r--parser.c17
-rw-r--r--xmlIO.c15
4 files changed, 30 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e5883f2..11a61625 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Oct 14 13:12:55 CEST 2002 Daniel Veillard <daniel@veillard.com>
+
+ * parser.c: Christian Glahn found a small bug in the push parser.
+ * xmlIO.c include/libxml/xmlIO.h: cleaned up and made xmlCheckFilename
+ public
+
Wed Oct 9 23:11:02 CEST 2002 Daniel Veillard <daniel@veillard.com>
* xmlschemas.c include/libxml/xmlschemas.h: added
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
index 7daa717e..d0ef8d67 100644
--- a/include/libxml/xmlIO.h
+++ b/include/libxml/xmlIO.h
@@ -254,6 +254,7 @@ xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL,
xmlChar *xmlNormalizeWindowsPath (const xmlChar *path);
+int xmlCheckFilename (const char *path);
/**
* Default 'file://' protocol callbacks
*/
diff --git a/parser.c b/parser.c
index 7311c9ef..2c579543 100644
--- a/parser.c
+++ b/parser.c
@@ -8894,6 +8894,14 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
/*
* Check for termination
*/
+ int avail = 0;
+ if (ctxt->input->buf == NULL)
+ avail = ctxt->input->length -
+ (ctxt->input->cur - ctxt->input->base);
+ else
+ avail = ctxt->input->buf->buffer->use -
+ (ctxt->input->cur - ctxt->input->base);
+
if ((ctxt->instate != XML_PARSER_EOF) &&
(ctxt->instate != XML_PARSER_EPILOG)) {
ctxt->errNo = XML_ERR_DOCUMENT_END;
@@ -8903,6 +8911,15 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
ctxt->wellFormed = 0;
ctxt->disableSAX = 1;
}
+ if ((ctxt->instate == XML_PARSER_EPILOG) && (avail > 0)) {
+ ctxt->errNo = XML_ERR_DOCUMENT_END;
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "Extra content at the end of the document\n");
+ ctxt->wellFormed = 0;
+ ctxt->disableSAX = 1;
+
+ }
if (ctxt->instate != XML_PARSER_EOF) {
if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
ctxt->sax->endDocument(ctxt->userData);
diff --git a/xmlIO.c b/xmlIO.c
index 796c8ac0..0972e3fa 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -261,25 +261,22 @@ xmlCleanupOutputCallbacks(void)
* returns 1. if stat fails, returns 0 (if calling
* stat on the filename fails, it can't be right).
* if stat succeeds and the file is a directory,
- * sets errno to EISDIR and returns 0. otherwise
- * returns 1.
+ * returns 2. otherwise returns 1.
*/
-static int
+int
xmlCheckFilename (const char *path)
{
#ifdef HAVE_STAT
-#ifdef S_ISDIR
struct stat stat_buffer;
if (stat(path, &stat_buffer) == -1)
return 0;
+#ifdef S_ISDIR
if (S_ISDIR(stat_buffer.st_mode)) {
- errno = EISDIR;
- return 0;
+ return 2;
}
-
#endif
#endif
return 1;
@@ -992,7 +989,7 @@ static void
xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
{
if ( ctxt->uri != NULL )
- free( ctxt->uri );
+ xmlFree( ctxt->uri );
if ( ctxt->doc_buff != NULL ) {
@@ -1007,7 +1004,7 @@ xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
}
}
- free( ctxt );
+ xmlFree( ctxt );
return;
}