diff options
author | Hugh Davenport <hugh@davenport.net.nz> | 2016-05-04 10:55:49 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2016-05-04 10:55:49 +0800 |
commit | b8e0fa3489b344d9cbd1165687e7dc5b15cc3727 (patch) | |
tree | 68c15d181eb7cbf84f79af09703d74c3906272ae | |
parent | 90da33cebeba87ae3b49a270c8182142dd7cb48e (diff) | |
download | libxml2-b8e0fa3489b344d9cbd1165687e7dc5b15cc3727.tar.gz |
Fix null pointer deref in docs with no root element
From https://bugzilla.gnome.org/show_bug.cgi?id=758514
-rw-r--r-- | xmllint.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; |