Fixing security bug

This commit is contained in:
Fabian Stamm
2022-05-21 17:55:14 +00:00
parent 94131c55a0
commit 71a6e3f2e0
2 changed files with 5 additions and 3 deletions

View File

@ -372,7 +372,9 @@ export class TypescriptTarget extends CompileTarget {
a(2, `if(Array.isArray(params)){`);
a(3, `p = params;`);
a(3, `while(p.length < ${fnc.inputs.length})`);
a(4, `p.push(undefined)`);
a(4, `p.push(undefined);`);
a(3, `if(p.length > ${fnc.inputs.length})`);
a(4, `throw new Error("Too many parameters!");`);
a(2, `} else {`);
for (const param of fnc.inputs) {
a(3, `p.push(params["${param.name}"])`);