grub2/grub-core/script
Daniel Axtens fe0586347e script/execute: Avoid crash when using "$#" outside a function scope
"$#" represents the number of arguments to a function. It is only
defined in a function scope, where "scope" is non-NULL. Currently,
if we attempt to evaluate "$#" outside a function scope, "scope" will
be NULL and we will crash with a NULL pointer dereference.

Do not attempt to count arguments for "$#" if "scope" is NULL. This
will result in "$#" being interpreted as an empty string if evaluated
outside a function scope.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2021-03-02 15:54:17 +01:00
..
argv.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
execute.c script/execute: Avoid crash when using "$#" outside a function scope 2021-03-02 15:54:17 +01:00
function.c script: Avoid a use-after-free when redefining a function during execution 2020-07-29 16:55:48 +02:00
lexer.c lexer: char const * should be const char * 2020-09-18 22:31:30 +02:00
main.c Remove nested functions from script reading and parsing. 2013-01-15 12:03:25 +00:00
parser.y script: Do not allow a delimiter between function name and block start 2020-09-18 22:31:30 +02:00
script.c Remove nested functions from script reading and parsing. 2013-01-15 12:03:25 +00:00
yylex.l yylex: Make lexer fatal errors actually be fatal 2020-07-29 16:55:47 +02:00