MT#59738 cfgtutils: fix optional key initialization

> #0  core_case_hash (s1=0x7ffdc61bbc70, size=16384, s2=<optimized out>) at ../../core/hashes.h:342
>        p = <optimized out>
>        end = 0x4 <error: Cannot access memory at address 0x4>
>        v = <optimized out>
>        h = 1746627962
>        p = <optimized out>
>        end = <optimized out>
>        v = <optimized out>
>        h = <optimized out>
>#1  cfg_lock_helper (lkey=lkey@entry=0x7ffdc61bbc70, lkey2=lkey2@entry=0x7ffdc61bbc80, mode=mode@entry=0) at ./src/modules/cfgutils/cfgutils.c:698
>        pos = <optimized out>
>        key2 = <optimized out>
>        __func__ = "cfg_lock_helper"
>#2  0x00007f48682334fc in w_cfg_lock_wrapper (msg=0x7f486e841990, key=<optimized out>, key2=0x0, mode=0) at ./src/modules/cfgutils/cfgutils.c:773
>        s1 = {s = 0x7f486b4c0720 "NGCP%invite_group_parallel%///1-178680@10.20.29.2_pbx-1_hg", len = 58}
>        s2 = {s = 0x0, len = 4}
>        __func__ = "w_cfg_lock_wrapper"

Change-Id: Ia7ca63911f54afe3fe1e72755ca90feb98bb6c9d
mr12.4
Victor Seva 2 years ago
parent a770a9a063
commit a530d04507

@ -35,6 +35,8 @@ sipwise/sca-add-pai_avp-parameter.patch
#
## upstream master
upstream/rtpengine_rework_rtpp_flags.patch
upstream/cfgutils-expose-optional-second-string-key-for-lock.patch
upstream/cfgutils-initialize-the-optional-key.patch
### relevant for upstream
sipwise/dialplan-don-t-stop-loading-rules-on-error.patch
sipwise/kamctl-TMPDIR-config.patch
@ -44,7 +46,6 @@ sipwise/lcr_read_id.patch
sipwise/dialog-support-profile_get_size-for-all-profiles.patch
sipwise/presence_vqr.patch
sipwise/dialog-dlg_get_ttag.patch
sipwise/cfgutils-expose-optional-second-string-key-for-lock.patch
sipwise/app_lua_sr-support-second-str-for-cfgutils-lock.patch
### active development
#

@ -0,0 +1,32 @@
From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Thu, 18 Apr 2024 15:29:39 +0200
Subject: cfgutils: initialize the optional key
* bug introduced at 424769743c93dea5a4d2c21f7a0ef8ea8779a5bb
---
src/modules/cfgutils/cfgutils.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/modules/cfgutils/cfgutils.c b/src/modules/cfgutils/cfgutils.c
index 6887af7..f20f3bb 100644
--- a/src/modules/cfgutils/cfgutils.c
+++ b/src/modules/cfgutils/cfgutils.c
@@ -679,7 +679,7 @@ static int cfg_lock_helper(str *lkey, str *lkey2, int mode)
unsigned int pos;
str *key2 = NULL;
- if(lkey2 && lkey2->len > 0) {
+ if(lkey2 && lkey2->s && lkey2->len > 0) {
key2 = lkey2;
}
@@ -758,7 +758,8 @@ static int cfg_trylock_key2(sip_msg_t *msg, str *lkey, str *lkey2)
static int w_cfg_lock_wrapper(
struct sip_msg *msg, gparam_p key, gparam_p key2, int mode)
{
- str s1, s2;
+ str s1;
+ str s2 = STR_NULL;
if(key == NULL) {
return -1;
}
Loading…
Cancel
Save