From: Glenn Washburn Date: Fri, 31 Jul 2020 14:33:22 +0000 (-0500) Subject: script: Do not allow a delimiter between function name and block start X-Git-Tag: grub-2.06-rc1~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac301e4dd0dabbb718aebf458ae8ce962078d0fe;p=thirdparty%2Fgrub.git script: Do not allow a delimiter between function name and block start Currently the following is valid syntax but should be a syntax error: grub> function f; { echo HERE; } grub> f HERE This fix is not backward compatible, but current syntax is not documented either and has no functional value. So any scripts with this unintended syntax are technically syntactically incorrect and should not be relying on this behavior. Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- diff --git a/grub-core/script/parser.y b/grub-core/script/parser.y index f80b86b6f..4a18ab7ba 100644 --- a/grub-core/script/parser.y +++ b/grub-core/script/parser.y @@ -279,7 +279,7 @@ function: "function" "name" $$ = state->scripts; state->scripts = 0; } - delimiters0 "{" commands1 delimiters1 "}" + newlines0 "{" commands1 delimiters1 "}" { struct grub_script *script; state->func_mem = grub_script_mem_record_stop (state,