[libxml2] Fix a crash with xmllint --path on empty results



commit bdc64d6d5f5f30982279af23cfa2d3ab08ba34c4
Author: Daniel Veillard <veillard redhat com>
Date:   Tue Mar 27 14:41:37 2012 +0800

    Fix a crash with xmllint --path on empty results
    
    If the returned node set is empty, it is possible for the nodetab
    to be null

 xmllint.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/xmllint.c b/xmllint.c
index 2acc7c5..39d7138 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2073,7 +2073,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) {
 #ifdef LIBXML_OUTPUT_ENABLED
             xmlSaveCtxtPtr ctxt;
 
-            if (cur->nodesetval->nodeNr <= 0) {
+            if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) {
                 fprintf(stderr, "XPath set is empty\n");
                 progresult = XMLLINT_ERR_XPATH;
                 break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]