Module: kamailio
Branch: 5.5
Commit: 31a507e1fba11b0cb94260bf6a7cfdcb640d2bb4
URL:
https://github.com/kamailio/kamailio/commit/31a507e1fba11b0cb94260bf6a7cfdc…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2023-05-08T15:13:06+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/31a507e1fba11b0cb94260bf6a7cfdc…
Patch:
https://github.com/kamailio/kamailio/commit/31a507e1fba11b0cb94260bf6a7cfdc…
---
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 29925cdb30f..6b01284e7cc 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -2273,6 +2273,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];
@@ -2467,10 +2472,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 {