Skip to content

Commit

Permalink
assert() statement: Fix crash on startup
Browse files Browse the repository at this point in the history
The asserted expression must be ran through the fixup logic before it
can be fully usable.  For example, this fixes:

    assert($var(x) =~ "X", "test-op-match-1");

(cherry picked from commit cf11718)
(cherry picked from commit 7345e9e)
  • Loading branch information
liviuchircu committed Oct 16, 2019
1 parent 755defe commit 51d6fa7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions route.c
Expand Up @@ -1132,6 +1132,17 @@ static int fix_actions(struct action* a)
}
}
break;
case ASSERT_T:
if (t->elem[0].type!=EXPR_ST){
LM_CRIT("invalid subtype %d for assert (should be expr)\n",
t->elem[0].type);
ret = E_BUG;
goto error;
}
if (t->elem[0].u.data)
if ((ret=fix_expr((struct expr*)t->elem[0].u.data))<0)
return ret;
break;
case IF_T:
if (t->elem[0].type!=EXPR_ST){
LM_CRIT("invalid subtype %d for if (should be expr)\n",
Expand Down

0 comments on commit 51d6fa7

Please sign in to comment.