From caf2f8c102236a4c2345bdd83d3190a3be295f22 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Sat, 27 Jan 2024 09:04:22 -0500 Subject: [PATCH] core: return error from parsing failure If the XML document could not be parsed then `root_element` will come out as NULL. Check this before trying to dereference it. Signed-off-by: Richard Fuchs --- core/parse-xml.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/parse-xml.c b/core/parse-xml.c index d42d95bde..ecde453e6 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -2348,6 +2348,9 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const struct xml_params *params xmlNode *root_element = xmlDocGetRootElement(doc); xmlChar *attribute; + if (!root_element) + return NULL; + while (info->root) { if ((strcasecmp((const char *)root_element->name, info->root) == 0)) { if (info->attribute == NULL)