1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

Use xmlStrlen in *CtxtReadDoc

xmlStrlen handles buffers larger than INT_MAX more gracefully.
This commit is contained in:
Nick Wellnhofer
2022-08-20 17:00:50 +02:00
parent b1b654171e
commit 5b2d07a726
2 changed files with 4 additions and 9 deletions

View File

@ -7116,13 +7116,10 @@ htmlDocPtr
htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur, htmlCtxtReadDoc(htmlParserCtxtPtr ctxt, const xmlChar * cur,
const char *URL, const char *encoding, int options) const char *URL, const char *encoding, int options)
{ {
const char *buf;
if (cur == NULL) if (cur == NULL)
return (NULL); return (NULL);
buf = (const char *) cur; return (htmlCtxtReadMemory(ctxt, (const char *) cur, xmlStrlen(cur), URL,
return (htmlCtxtReadMemory(ctxt, buf, strlen(buf), URL, encoding, encoding, options));
options));
} }
/** /**

View File

@ -15359,12 +15359,10 @@ xmlDocPtr
xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur, xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur,
const char *URL, const char *encoding, int options) const char *URL, const char *encoding, int options)
{ {
const char *buf;
if (cur == NULL) if (cur == NULL)
return (NULL); return (NULL);
buf = (const char *) cur; return (xmlCtxtReadMemory(ctxt, (const char *) cur, xmlStrlen(cur), URL,
return (xmlCtxtReadMemory(ctxt, buf, strlen(buf), URL, encoding, options)); encoding, options));
} }
/** /**