Skip to content

Commit

Permalink
lcr: safety checks for parms of kemi functions
Browse files Browse the repository at this point in the history
(cherry picked from commit c0c374e)
  • Loading branch information
miconda committed Dec 8, 2017
1 parent 01c6561 commit b530e91
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/modules/lcr/lcr_mod.c
Expand Up @@ -2201,8 +2201,9 @@ static int ki_load_gws_furi(sip_msg_t *_m, int lcr_id, str *ruri_user,
struct usr_avp *avp;
struct search_state st;

LM_DBG("load_gws(%u, %.*s, %.*s)\n", lcr_id, ruri_user->len, ruri_user->s,
from_uri->len, from_uri->s);
LM_DBG("load_gws(%u, %.*s, %.*s)\n", lcr_id,
ruri_user->len, ZSW(ruri_user->s),
from_uri->len, ZSW(from_uri->s));

request_uri = GET_RURI(_m);

Expand Down Expand Up @@ -2363,6 +2364,10 @@ static int ki_load_gws_ruser(sip_msg_t *_m, int lcr_id, str *ruri_user)
{
str from_uri = STR_NULL;

if(ruri_user==NULL || ruri_user->s==NULL) {
LM_ERR("invalid parameter\n");
return -1;
}
return ki_load_gws_furi(_m, lcr_id, ruri_user, &from_uri);
}

Expand All @@ -2371,9 +2376,15 @@ static int ki_load_gws_ruser(sip_msg_t *_m, int lcr_id, str *ruri_user)
*/
static int ki_load_gws(sip_msg_t *_m, int lcr_id)
{
str ruri_user = STR_NULL;
str ruri_user;
str from_uri = STR_NULL;

if ((parse_sip_msg_uri(_m) < 0) || (!_m->parsed_uri.user.s)) {
LM_ERR("error while parsing R-URI\n");
return -1;
}
ruri_user = _m->parsed_uri.user;

return ki_load_gws_furi(_m, lcr_id, &ruri_user, &from_uri);
}

Expand Down Expand Up @@ -3444,4 +3455,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
{
sr_kemi_modules_add(sr_kemi_lcr_exports);
return 0;
}
}

0 comments on commit b530e91

Please sign in to comment.