From aa4612480424ad2fede0cd4ae4c7a893f61c6c0f Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 19 Mar 2010 09:41:18 +0100 Subject: Clear local variables in filters and functions. Fixes crash when used uninitialized variables. This problem was surprisingly tricky to fix. --- filter/config.Y | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'filter/config.Y') diff --git a/filter/config.Y b/filter/config.Y index fcbee71..1af5649 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -172,7 +172,14 @@ function_params: function_body: decls '{' cmds '}' { - $$ = $3; + if ($1) { + /* Prepend instruction to clear local variables */ + $$ = f_new_inst(); + $$->code = P('c','v'); + $$->a1.p = $1; + $$->next = $3; + } else + $$ = $3; } ; -- cgit v1.2.3