mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-07 06:43:02 +03:00
trying to fix #114277 about when file remapping and escaping should really
* parser.c xmlIO.c: trying to fix #114277 about when file remapping and escaping should really be attempted. Daniel
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Mon Jun 9 12:28:58 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* parser.c xmlIO.c: trying to fix #114277 about when file
|
||||||
|
remapping and escaping should really be attempted.
|
||||||
|
|
||||||
Mon Jun 9 11:06:09 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
Mon Jun 9 11:06:09 CEST 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* doc/*: applied a patch from Gman for building docs
|
* doc/*: applied a patch from Gman for building docs
|
||||||
|
11
parser.c
11
parser.c
@@ -10558,7 +10558,6 @@ xmlCreateFileParserCtxt(const char *filename)
|
|||||||
{
|
{
|
||||||
xmlParserCtxtPtr ctxt;
|
xmlParserCtxtPtr ctxt;
|
||||||
xmlParserInputPtr inputStream;
|
xmlParserInputPtr inputStream;
|
||||||
char *canonicFilename;
|
|
||||||
char *directory = NULL;
|
char *directory = NULL;
|
||||||
|
|
||||||
ctxt = xmlNewParserCtxt();
|
ctxt = xmlNewParserCtxt();
|
||||||
@@ -10569,16 +10568,8 @@ xmlCreateFileParserCtxt(const char *filename)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
|
|
||||||
if (canonicFilename == NULL) {
|
|
||||||
if (xmlDefaultSAXHandler.error != NULL) {
|
|
||||||
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
|
|
||||||
}
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt);
|
inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
|
||||||
xmlFree(canonicFilename);
|
|
||||||
if (inputStream == NULL) {
|
if (inputStream == NULL) {
|
||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
28
xmlIO.c
28
xmlIO.c
@@ -532,20 +532,22 @@ xmlGzfileOpen_real (const char *filename) {
|
|||||||
* xmlGzfileOpen:
|
* xmlGzfileOpen:
|
||||||
* @filename: the URI for matching
|
* @filename: the URI for matching
|
||||||
*
|
*
|
||||||
* Wrapper around xmlGzfileOpen that try it with an unescaped
|
* Wrapper around xmlGzfileOpen if the open fais, it will
|
||||||
* version of @filename, if this fails fallback to @filename
|
* try to unescape @filename
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
xmlGzfileOpen (const char *filename) {
|
xmlGzfileOpen (const char *filename) {
|
||||||
char *unescaped;
|
char *unescaped;
|
||||||
void *retval;
|
void *retval;
|
||||||
|
|
||||||
|
retval = xmlGzfileOpen_real(filename);
|
||||||
|
if (retval == NULL) {
|
||||||
unescaped = xmlURIUnescapeString(filename, 0, NULL);
|
unescaped = xmlURIUnescapeString(filename, 0, NULL);
|
||||||
if (unescaped != NULL) {
|
if (unescaped != NULL) {
|
||||||
retval = xmlGzfileOpen_real(unescaped);
|
retval = xmlGzfileOpen_real(unescaped);
|
||||||
} else {
|
|
||||||
retval = xmlGzfileOpen_real(filename);
|
|
||||||
}
|
}
|
||||||
xmlFree(unescaped);
|
xmlFree(unescaped);
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2487,7 +2489,6 @@ xmlParserGetDirectory(const char *filename) {
|
|||||||
* *
|
* *
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#ifdef LIBXML_CATALOG_ENABLED
|
|
||||||
static int xmlSysIDExists(const char *URL) {
|
static int xmlSysIDExists(const char *URL) {
|
||||||
#ifdef HAVE_STAT
|
#ifdef HAVE_STAT
|
||||||
int ret;
|
int ret;
|
||||||
@@ -2517,7 +2518,6 @@ static int xmlSysIDExists(const char *URL) {
|
|||||||
#endif
|
#endif
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlDefaultExternalEntityLoader:
|
* xmlDefaultExternalEntityLoader:
|
||||||
@@ -2669,6 +2669,22 @@ xmlGetExternalEntityLoader(void) {
|
|||||||
xmlParserInputPtr
|
xmlParserInputPtr
|
||||||
xmlLoadExternalEntity(const char *URL, const char *ID,
|
xmlLoadExternalEntity(const char *URL, const char *ID,
|
||||||
xmlParserCtxtPtr ctxt) {
|
xmlParserCtxtPtr ctxt) {
|
||||||
|
if ((URL != NULL) && (xmlSysIDExists(URL) == 0)) {
|
||||||
|
char *canonicFilename;
|
||||||
|
xmlParserInputPtr ret;
|
||||||
|
|
||||||
|
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) URL);
|
||||||
|
if (canonicFilename == NULL) {
|
||||||
|
if (xmlDefaultSAXHandler.error != NULL) {
|
||||||
|
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = xmlCurrentExternalEntityLoader(canonicFilename, ID, ctxt);
|
||||||
|
xmlFree(canonicFilename);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
return(xmlCurrentExternalEntityLoader(URL, ID, ctxt));
|
return(xmlCurrentExternalEntityLoader(URL, ID, ctxt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user