[libxml2] potential NULL dereference on non-glibc



commit 669e88c0650646a6d4eae978296ad753a2a47b7f
Author: Jim Meyering <jim meyering net>
Date:   Wed Jul 29 11:33:32 2009 +0200

    potential NULL dereference on non-glibc
    
    * SAX2.c (xmlCheckDefaultedAttributes): When xmlStrdup and/or
      xmlStrcat fails due to OOM avoid printing NULL via a printf-style "%s"
      format

 SAX2.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/SAX2.c b/SAX2.c
index 164409c..8dc1d58 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -1420,6 +1420,10 @@ process_external_subset:
 		    } else {
 			fulln = xmlStrdup(attr->name);
 		    }
+                    if (fulln == NULL) {
+                        xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
+                        break;
+                    }
 
 		    /*
 		     * Check that the attribute is not declared in the



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