Skip to content

Commit

Permalink
lcr: check return for rewrite_uri() and do memset with size of alloc
Browse files Browse the repository at this point in the history
(cherry picked from commit 67bd080)
  • Loading branch information
miconda committed Aug 30, 2017
1 parent 6872ead commit fa2ff3a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/modules/lcr/lcr_mod.c
Expand Up @@ -686,8 +686,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 */
Expand Down Expand Up @@ -2522,7 +2521,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) {
Expand All @@ -2531,7 +2533,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;
}

Expand Down

0 comments on commit fa2ff3a

Please sign in to comment.