File pacemaker#3361-0001-Low-libcrmcommon-Don-t-try-to-parse-XML-from-bad-.bz.patch of Package pacemaker.34783

From f5bc32650abf0ebe2d3ad8e4f1d85e5a2965c841 Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Fri, 9 Feb 2024 12:34:44 -0800
Subject: [PATCH 1/2] Low: libcrmcommon: Don't try to parse XML from bad .bz2
 file

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
 lib/common/xml.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: pacemaker-2.1.5+20221208.a3f44794f/lib/common/xml.c
===================================================================
--- pacemaker-2.1.5+20221208.a3f44794f.orig/lib/common/xml.c
+++ pacemaker-2.1.5+20221208.a3f44794f/lib/common/xml.c
@@ -1133,9 +1133,11 @@ filename2xml(const char *filename)
     } else {
         char *input = decompress_file(filename);
 
-        output = xmlCtxtReadDoc(ctxt, (pcmkXmlStr) input, NULL, NULL,
-                                PCMK__XML_PARSE_OPTS);
-        free(input);
+        if (input != NULL) {
+            output = xmlCtxtReadDoc(ctxt, (pcmkXmlStr) input, NULL, NULL,
+                                    PCMK__XML_PARSE_OPTS);
+            free(input);
+        }
     }
 
     if (output && (xml = xmlDocGetRootElement(output))) {
openSUSE Build Service is sponsored by