mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-15 23:24:06 +03:00
Fix null pointer deref in docs with no root element
From https://bugzilla.gnome.org/show_bug.cgi?id=758514
This commit is contained in:
parent
90da33cebe
commit
b8e0fa3489
@ -2002,6 +2002,12 @@ static void walkDoc(xmlDocPtr doc) {
|
||||
xmlNsPtr ns;
|
||||
|
||||
root = xmlDocGetRootElement(doc);
|
||||
if (root == NULL ) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Document does not have a root element");
|
||||
progresult = XMLLINT_ERR_UNCLASS;
|
||||
return;
|
||||
}
|
||||
for (ns = root->nsDef, i = 0;ns != NULL && i < 20;ns=ns->next) {
|
||||
namespaces[i++] = ns->href;
|
||||
namespaces[i++] = ns->prefix;
|
||||
|
Loading…
x
Reference in New Issue
Block a user