Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
pacemaker
pacemaker#3292-0002-Low-libcrmcommon-fix-NULL-d...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker#3292-0002-Low-libcrmcommon-fix-NULL-dereference-in-expand_idre.patch of Package pacemaker
From c5715a0aaa8c8e4900df5292f9d0e5236cc86050 Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Thu, 14 Dec 2023 15:53:41 -0600 Subject: [PATCH] Low: libcrmcommon: fix NULL dereference in expand_idref() ... detected by static analysis. Also, rename variables and reformat for readability. --- lib/common/xml.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/common/xml.c b/lib/common/xml.c index c9a07eed4..5611c7985 100644 --- a/lib/common/xml.c +++ b/lib/common/xml.c @@ -2555,32 +2555,32 @@ crm_xml_cleanup(void) xmlNode * expand_idref(xmlNode * input, xmlNode * top) { + char *xpath = NULL; const char *ref = NULL; - xmlNode *result = input; + xmlNode *result = NULL; - if (result == NULL) { + if (input == NULL) { return NULL; - - } else if (top == NULL) { - top = input; } - ref = crm_element_value(result, XML_ATTR_IDREF); - if (ref != NULL) { - char *xpath_string = crm_strdup_printf("//%s[@" XML_ATTR_ID "='%s']", - result->name, ref); + ref = crm_element_value(input, XML_ATTR_IDREF); + if (ref == NULL) { + return input; + } - result = get_xpath_object(xpath_string, top, LOG_DEBUG); - if (result == NULL) { // Not possible with schema validation enabled - char *nodePath = (char *)xmlGetNodePath(top); + if (top == NULL) { + top = input; + } - pcmk__config_err("Ignoring invalid %s configuration: " - XML_ATTR_IDREF " '%s' does not reference " - "a valid object", result->name, ref); - free(nodePath); - } - free(xpath_string); + xpath = crm_strdup_printf("//%s[@" XML_ATTR_ID "='%s']", input->name, ref); + result = get_xpath_object(xpath, top, LOG_DEBUG); + if (result == NULL) { // Not possible with schema validation enabled + pcmk__config_err("Ignoring invalid %s configuration: " + XML_ATTR_IDREF " '%s' does not reference " + "a valid object " CRM_XS " xpath=%s", + input->name, ref, xpath); } + free(xpath); return result; } -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor