Skip to content

Commit

Permalink
core: cfg select - safety check accessing vars before initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Oct 19, 2018
1 parent f4fb19d commit 97855a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/cfg/cfg_select.c
Expand Up @@ -220,7 +220,12 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg *msg)
break;

case CFG_VAR_STR:
memcpy(res, p, sizeof(str));
if(p) {
memcpy(res, p, sizeof(str));
} else {
res->s = 0;
res->len = 0;
}
break;

default:
Expand Down

0 comments on commit 97855a1

Please sign in to comment.