From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k1W6z-000854-NP for mharc-grub-devel@gnu.org; Fri, 31 Jul 2020 10:34:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1W6y-00082W-J3 for grub-devel@gnu.org; Fri, 31 Jul 2020 10:34:16 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:41232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1W6w-0007am-RI for grub-devel@gnu.org; Fri, 31 Jul 2020 10:34:16 -0400 Received: by mail-pg1-x542.google.com with SMTP id s15so4574285pgc.8 for ; Fri, 31 Jul 2020 07:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=drKr23eXAhTlwat7G+Psmr4CKLEvOQoNAPjcOGRsE9Q=; b=FFk2daFzl0ImUUaEJZBjQxNGJc3ni4+LPZe0MsUsdoW1LYr8NzzDy9LV08RK+2qe/o f4LTRu+ZSGG3fXLbjH4Z/I8cTf54KVvdkbRkeTqEdVGemIwl5jFBdJEEJdhdW8l0+ji3 QWA3gV1dBJVD+Jylw0m4M8n022vfam/6bb0bof1Q8anaapgab8X1ssKCC+VeUPmXOJQi mNr5aYpo4y1204HYAre9ql33d3U58XlSx5ykrJQ8Vifqst+6TJPO+ybcknH2Z2lSxW92 mEF76E8nHUz8vtInh3pDIm7NM5gRoL0gvCZMdKCOJwTsvZ6iSZNS9dbuTkeCymI/wwrG IC2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=drKr23eXAhTlwat7G+Psmr4CKLEvOQoNAPjcOGRsE9Q=; b=nByd1EXF+Hmty9tcT85rjDlZ6KbAQ8/bGaMsoDLvOiFXes6csC4reiXrTPu+ZzRMT0 jtYPmeRKYNxecCmyq4QLeSFh6dYYf7B4SE9gxxi/t5i6KtqpTsqGTmAFDSi3zn8NcrM4 K1zcWZ7LSYHfug1K/bYysXltE+bpG3qknAkxdj5N0rDwDXk/ahSY+n2Jt87cnDoNbJ6k uCxC30QmJqkdxZ9sZAQRziJcuHFl4NszKDCCzMS+3dLo9zLkpkw42jvN9uNPq1djmJCk ZtLOxzAXkwtTja0Ca+qUEFSOtGXwtgKdaNt2e5kyMVou5k8zpgHtMD6vpvPlWLrG/BqR R0AA== X-Gm-Message-State: AOAM532yvJC9pSmrEwcCPefrb8//YiEQUGwmfPsKGmFy8v5tMiqCUy7A hDjzyimhxnIlDt8K9HRJkT+4hhXCZhY= X-Google-Smtp-Source: ABdhPJy/MsRfyH4TqfsvnIH3I8k6uioGXT3g+Dq6z7Yb14Q42j7Tq80lUPiEelIs+Fo40UtkefcBYA== X-Received: by 2002:a62:38cb:: with SMTP id f194mr4012471pfa.243.1596206053337; Fri, 31 Jul 2020 07:34:13 -0700 (PDT) Received: from localhost.localdomain ([189.216.105.24]) by smtp.gmail.com with ESMTPSA id x136sm9856240pfc.28.2020.07.31.07.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 07:34:12 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH] script: Do not allow a delimiter between function name and block start. Date: Fri, 31 Jul 2020 09:33:22 -0500 Message-Id: <20200731143323.1650165-5-development@efficientek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200731143323.1650165-1-development@efficientek.com> References: <20200731143323.1650165-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::542; envelope-from=development@efficientek.com; helo=mail-pg1-x542.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2020 14:34:16 -0000 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 --- grub-core/script/parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, -- 2.25.1