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

Author: Victor Seva <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2023-05-04T20:53:09+02:00

lcr: fix crash be calling load_gw* via KEMI

move the check of lcr_id to the helper

fixes #3435

---

Modified: src/modules/lcr/lcr_mod.c

---

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

---

diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 1f713a9e404..be945fb8af8 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -2298,6 +2298,11 @@ static int ki_load_gws_furi(
                }
        }
 
+       if((lcr_id < 1) || (lcr_id > lcr_count_param)) {
+               LM_ERR("invalid lcr_id parameter value %d\n", lcr_id);
+               return -1;
+       }
+
        /* Use rules and gws with index lcr_id */
        rules = rule_pt[lcr_id];
        gws = gw_pt[lcr_id];
@@ -2492,10 +2497,7 @@ static int load_gws(struct sip_msg *_m, int argc, 
action_u_t argv[])
                LM_ERR("invalid lcr_id parameter %s\n", argv[0].u.string);
                return -1;
        }
-       if((lcr_id < 1) || (lcr_id > lcr_count_param)) {
-               LM_ERR("invalid lcr_id parameter value %d\n", lcr_id);
-               return -1;
-       }
+
        if(argc > 1) {
                ruri_user = argv[1].u.str;
        } else {

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to [email protected]

Reply via email to