Module: kamailio
Branch: master
Commit: b9e7e3f9bf59a396982531f93e2ac4a274b557bb
URL: 
https://github.com/kamailio/kamailio/commit/b9e7e3f9bf59a396982531f93e2ac4a274b557bb

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-06-05T05:51:52+02:00

kemix: checks for define name parameters

---

Modified: src/modules/kemix/kemix_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/b9e7e3f9bf59a396982531f93e2ac4a274b557bb.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b9e7e3f9bf59a396982531f93e2ac4a274b557bb.patch

---

diff --git a/src/modules/kemix/kemix_mod.c b/src/modules/kemix/kemix_mod.c
index 71ef0453f90..c39e22010a4 100644
--- a/src/modules/kemix/kemix_mod.c
+++ b/src/modules/kemix/kemix_mod.c
@@ -1167,9 +1167,13 @@ static sr_kemi_xval_t *ki_kx_get_def(sip_msg_t *msg, str 
*dname)
 {
        str *val;
 
-       val = pp_define_get(dname->len, dname->s);
-
        memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
+       if(dname == NULL || dname->s == NULL || dname->len <= 0) {
+               sr_kemi_xval_null(&_sr_kemi_kx_xval, SR_KEMI_XVAL_NULL_EMPTY);
+               return &_sr_kemi_kx_xval;
+       }
+
+       val = pp_define_get(dname->len, dname->s);
        if(val == NULL) {
                sr_kemi_xval_null(&_sr_kemi_kx_xval, SR_KEMI_XVAL_NULL_EMPTY);
                return &_sr_kemi_kx_xval;
@@ -1189,6 +1193,10 @@ static int ki_kx_get_defn(sip_msg_t *msg, str *dname)
        str *val;
        int n = 0;
 
+       if(dname == NULL || dname->s == NULL || dname->len <= 0) {
+               return 0;
+       }
+
        val = pp_define_get(dname->len, dname->s);
 
        if(val != NULL) {
@@ -1205,6 +1213,10 @@ static int ki_kx_ifdef(sip_msg_t *msg, str *dname)
 {
        str *val;
 
+       if(dname == NULL || dname->s == NULL || dname->len <= 0) {
+               return SR_KEMI_FALSE;
+       }
+
        val = pp_define_get(dname->len, dname->s);
 
        if(val != NULL) {
@@ -1220,6 +1232,10 @@ static int ki_kx_ifndef(sip_msg_t *msg, str *dname)
 {
        str *val;
 
+       if(dname == NULL || dname->s == NULL || dname->len <= 0) {
+               return SR_KEMI_TRUE;
+       }
+
        val = pp_define_get(dname->len, dname->s);
 
        if(val == NULL) {

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to