1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

Possible overflow in HTMLParser.c

For https://bugzilla.gnome.org/show_bug.cgi?id=720615

make sure that the encoding string passed is of reasonable size
This commit is contained in:
Daniel Veillard
2014-10-06 18:51:04 +08:00
parent 6bea543eca
commit 292a9f293d

View File

@@ -6288,12 +6288,16 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
/* set encoding */
if (encoding) {
content = xmlMallocAtomic (xmlStrlen(content_line) + strlen(encoding) + 1);
if (content) {
strcpy ((char *)content, (char *)content_line);
strcat ((char *)content, (char *)encoding);
htmlCheckEncoding (ctxt, content);
xmlFree (content);
size_t l = strlen(encoding);
if (l < 1000) {
content = xmlMallocAtomic (xmlStrlen(content_line) + l + 1);
if (content) {
strcpy ((char *)content, (char *)content_line);
strcat ((char *)content, (char *)encoding);
htmlCheckEncoding (ctxt, content);
xmlFree (content);
}
}
}