Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
pacemaker
pacemaker#3394-0004-Low-libcrmcommon-NULL-check...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker#3394-0004-Low-libcrmcommon-NULL-check-strdup-in-pcmk__register.patch of Package pacemaker
From b5caaa97179f86d11a062f5be7f1b22ac3aeef66 Mon Sep 17 00:00:00 2001 From: Reid Wahl <nrwahl@protonmail.com> Date: Wed, 20 Mar 2024 20:10:24 -0700 Subject: [PATCH 4/4] Low: libcrmcommon: NULL-check strdup() in pcmk__register_message() Dereferencing null pointer found by cppcheck. Assert on failure. This is a library function but doesn't currently return anything. Also, this would have segfaulted in the past. Signed-off-by: Reid Wahl <nrwahl@protonmail.com> --- lib/common/output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: pacemaker-2.1.7+20231219.0f7f88312/lib/common/output.c =================================================================== --- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/common/output.c +++ pacemaker-2.1.7+20231219.0f7f88312/lib/common/output.c @@ -194,9 +194,17 @@ pcmk__call_message(pcmk__output_t *out, void pcmk__register_message(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn) { + char *message_id_copy = NULL; + CRM_ASSERT(out != NULL && !pcmk__str_empty(message_id) && fn != NULL); - g_hash_table_replace(out->messages, strdup(message_id), fn); + message_id_copy = strdup(message_id); + if (message_id_copy == NULL) { + crm_abort(__FILE__, __func__, __LINE__, "Out of memory", FALSE, TRUE); + crm_exit(CRM_EX_OSERR); + } + + g_hash_table_replace(out->messages, message_id_copy, fn); } void
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