Skip to content

Commit

Permalink
Fix proper testing of context content
Browse files Browse the repository at this point in the history
If a STR is register to the context, a valid STR * will be always returned , so we need to test the content, not the pointer.
  • Loading branch information
bogdan-iancu committed Jun 17, 2016
1 parent c6dddd0 commit 968a8a8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/rr/loose.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,8 @@ int get_route_params(struct sip_msg *msg, str *val)
return -1;

/* check if params are present */
if ( (val=ctx_rrparam_get())==NULL )
*val = *ctx_rrparam_get();
if (val->s==NULL || val->len==0)
return -1;

return 0;
Expand All @@ -936,7 +937,8 @@ int check_route_param(struct sip_msg * msg, regex_t* re)
str *rparams;

/* check if params are present */
if ( (rparams=ctx_rrparam_get())==NULL || rparams->len==0)
rparams = ctx_rrparam_get();
if (rparams->s==NULL || rparams->len==0)
return -1;

/* include also the first ';' */
Expand Down Expand Up @@ -966,7 +968,8 @@ int get_route_param( struct sip_msg *msg, str *name, str *val)
str *rparams;

/* check if params are present */
if ( (rparams=ctx_rrparam_get())==NULL || rparams->len==0)
rparams = ctx_rrparam_get();
if (rparams->s==NULL || rparams->len==0)
goto notfound;

end = rparams->s + rparams->len;
Expand Down

0 comments on commit 968a8a8

Please sign in to comment.