Fix segfault in unlimited params

This commit is contained in:
Bill Currie 2020-02-19 02:30:50 +09:00
parent c61d0b6ff0
commit 2d52da9c0d

View file

@ -330,8 +330,9 @@ find_function (expr_t *fexpr, expr_t *params)
return e;
type.t.func.num_params++;
}
if (type.t.func.num_params > MAX_PARMS)
return fexpr;
i = type.t.func.num_params * sizeof (type_t);
type.t.func.param_types = alloca(i);
memset (type.t.func.param_types, 0, i);
for (i = 0, e = params; e; i++, e = e->next) {
type.t.func.param_types[type.t.func.num_params - 1 - i] = get_type (e);
if (e->type == ex_error)