Hardening of code checking node types in EXSLT
authorDaniel Veillard <veillard@redhat.com>
Thu, 16 Aug 2012 07:51:35 +0000 (15:51 +0800)
committerDaniel Veillard <veillard@redhat.com>
Thu, 16 Aug 2012 07:51:35 +0000 (15:51 +0800)
libexslt/functions.c

index 13fd06e..4c68cea 100644 (file)
@@ -459,10 +459,9 @@ exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
     xmlHashTablePtr data;
     exsltFuncFunctionData *func;
 
-    if ((style == NULL) || (inst == NULL))
+    if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
        return;
 
-
     {
        xmlChar *qname;
 
@@ -546,6 +545,9 @@ exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
     xmlChar *sel;
     exsltFuncResultPreComp *ret;
 
+    if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
+        return (NULL);
+
     /*
      * "Validity" checking
      */