[libxml2] Fix return value of xmlC14NDocDumpMemory



commit 84bab955fe01c50e64382481de67259047d917a9
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Wed Jun 24 20:07:32 2020 +0200

    Fix return value of xmlC14NDocDumpMemory
    
    Make sure to return -1 in case of buffer errors.
    
    Fixes #174.

 c14n.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/c14n.c b/c14n.c
index d2dce932..3efcd92e 100644
--- a/c14n.c
+++ b/c14n.c
@@ -2033,13 +2033,13 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes,
     }
 
     ret = xmlBufUse(buf->buffer);
-    if (ret > 0) {
+    if (ret >= 0) {
         *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), ret);
     }
     (void) xmlOutputBufferClose(buf);
 
-    if ((*doc_txt_ptr == NULL) && (ret > 0)) {
-        xmlC14NErrMemory("coping canonicalized document");
+    if ((*doc_txt_ptr == NULL) && (ret >= 0)) {
+        xmlC14NErrMemory("copying canonicalized document");
         return (-1);
     }
     return (ret);


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