[libxml2] Clear up a potential NULL dereference



commit ff76eb28c75451bc56e3b93f44dac155ca29e7f5
Author: Daniel Veillard <veillard redhat com>
Date:   Sat Aug 3 22:25:13 2013 +0800

    Clear up a potential NULL dereference
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705399
    
    if ctxt->node_seq.buffer is null then ctxt->node_seq.maximum ought
    to be zero but it's better to clarify the check in the code directly.

 parserInternals.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/parserInternals.c b/parserInternals.c
index f8a7041..98a5836 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1990,7 +1990,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt,
 
     /* Otherwise, we need to add new node to buffer */
     else {
-        if (ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) {
+        if ((ctxt->node_seq.length + 1 > ctxt->node_seq.maximum) ||
+           (ctxt->node_seq.buffer == NULL)) {
             xmlParserNodeInfo *tmp_buffer;
             unsigned int byte_size;
 


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