Module: kamailio
Branch: 5.6
Commit: dc2ff878fb5971f78760f62eb1a70ba9ac1c0d9a
URL: 
https://github.com/kamailio/kamailio/commit/dc2ff878fb5971f78760f62eb1a70ba9ac1c0d9a

Author: Victor Seva <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2023-05-08T15:12:41+02:00

lcr: fix crash be calling load_gw* via KEMI

move the check of lcr_id to the helper

fixes #3435

(cherry picked from commit c88e506fe6a1ba0f588c5866a63ffb18fa25478a)

---

Modified: src/modules/lcr/lcr_mod.c

---

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

---

diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 2e33df0ed96..310b6dbbc21 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -2299,6 +2299,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];
@@ -2493,10 +2498,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