Module: kamailio
Branch: 5.7
Commit: 3bab39400f493647f8d6ec98c361b95cb43f0295
URL:
https://github.com/kamailio/kamailio/commit/3bab39400f493647f8d6ec98c361b95…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2023-05-08T15:12:16+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/3bab39400f493647f8d6ec98c361b95…
Patch:
https://github.com/kamailio/kamailio/commit/3bab39400f493647f8d6ec98c361b95…
---
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 1f713a9e40..be945fb8af 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 {