Blame SOURCES/cve-2022-31213.patch

bb4389
From 4fefc3908ce527de4ca3d7386886c2447d6b4c14 Mon Sep 17 00:00:00 2001
bb4389
From: David Rheinsberg <david.rheinsberg@gmail.com>
bb4389
Date: Tue, 19 Apr 2022 13:29:53 +0200
bb4389
Subject: [PATCH] launch/config: keep empty cdata around
bb4389
bb4389
We expect the `node->cdata` pointer to contain the actual content of an
bb4389
XML entry. Make sure it is initialized to an empty string, so we can
bb4389
dereference it without checking for validity everywhere.
bb4389
bb4389
Note that we want it to be an owned string, to allow claiming the value.
bb4389
We will avoid any `n_cdata + 'static ""` here, to keep the code simple.
bb4389
The performance of that strdup() merely affects XML parsing, no bus
bb4389
runtime.
bb4389
bb4389
Reported-by: Steffen Robertz
bb4389
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
bb4389
---
bb4389
 src/launch/config.c | 4 ++++
bb4389
 1 file changed, 4 insertions(+)
bb4389
bb4389
diff --git a/src/launch/config.c b/src/launch/config.c
bb4389
index 490d7b7d..cb7e3fae 100644
bb4389
--- a/src/launch/config.c
bb4389
+++ b/src/launch/config.c
bb4389
@@ -133,6 +133,10 @@ int config_node_new(ConfigNode **nodep, ConfigNode *parent, unsigned int type) {
bb4389
                 break;
bb4389
         }
bb4389
 
bb4389
+        node->cdata = strdup("");
bb4389
+        if (!node->cdata)
bb4389
+                return error_origin(-ENOMEM);
bb4389
+
bb4389
         *nodep = node;
bb4389
         node = NULL;
bb4389
         return 0;