]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
script: Do not allow a delimiter between function name and block start
authorGlenn Washburn <development@efficientek.com>
Fri, 31 Jul 2020 14:33:22 +0000 (09:33 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 18 Sep 2020 20:31:30 +0000 (22:31 +0200)
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 <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/script/parser.y

index f80b86b6f1546259e384432030299abdc469860c..4a18ab7ba2b7f4a2b1c6597ccbde171cacf60b7c 100644 (file)
@@ -279,7 +279,7 @@ function: "function" "name"
            $<scripts>$ = state->scripts;
            state->scripts = 0;
           }
-          delimiters0 "{" commands1 delimiters1 "}"
+          newlines0 "{" commands1 delimiters1 "}"
           {
             struct grub_script *script;
             state->func_mem = grub_script_mem_record_stop (state,