[libxml2] Fix null pointer deref in docs with no root element
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix null pointer deref in docs with no root element
- Date: Wed, 4 May 2016 02:57:20 +0000 (UTC)
commit b8e0fa3489b344d9cbd1165687e7dc5b15cc3727
Author: Hugh Davenport <hugh davenport net nz>
Date: Wed May 4 10:55:49 2016 +0800
Fix null pointer deref in docs with no root element
From https://bugzilla.gnome.org/show_bug.cgi?id=758514
xmllint.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/xmllint.c b/xmllint.c
index 9e85c11..00f1769 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]