Module: kamailio
Branch: master
Commit: 67bd080310c5b8371d9943fa964e81154c916356
URL:
https://github.com/kamailio/kamailio/commit/67bd080310c5b8371d9943fa964e811…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-07-27T12:42:42+02:00
lcr: check return for rewrite_uri() and do memset with size of alloc
---
Modified: src/modules/lcr/lcr_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/67bd080310c5b8371d9943fa964e811…
Patch:
https://github.com/kamailio/kamailio/commit/67bd080310c5b8371d9943fa964e811…
---
diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index 1313d65aff..02bad0bb5e 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -709,8 +709,7 @@ static int mod_init(void)
LM_ERR("no memory for gw table\n");
goto err;
}
- memset(gw_pt[i], 0, sizeof(struct gw_info *) *
- (lcr_gw_count_param + 1));
+ memset(gw_pt[i], 0, sizeof(struct gw_info) * (lcr_gw_count_param + 1));
}
/* Allocate and initialize locks */
@@ -2750,7 +2749,10 @@ static int next_gw(struct sip_msg* _m, char* _s1, char* _s2)
/* Rewrite Request URI */
uri_str.s = r_uri;
uri_str.len = r_uri_len;
- rewrite_uri(_m, &uri_str);
+ if(rewrite_uri(_m, &uri_str)<0) {
+ LM_ERR("failed to rewrite uri\n");
+ return -1;
+ }
/* Set Destination URI if not empty */
if (dst_uri_len > 0) {
@@ -2759,7 +2761,7 @@ static int next_gw(struct sip_msg* _m, char* _s1, char* _s2)
LM_DBG("setting du to <%.*s>\n", uri_str.len, uri_str.s);
rval = set_dst_uri(_m, &uri_str);
if (rval != 0) {
- LM_ERR("calling do_action failed with return value <%d>\n", rval);
+ LM_ERR("calling set dst uri failed with return value <%d>\n",
rval);
return -1;
}