]> git.ipfire.org Git - thirdparty/grub.git/commit
script/execute: Don't crash on a "for" loop with no items
authorDaniel Axtens <dja@axtens.net>
Fri, 22 Jan 2021 05:18:26 +0000 (16:18 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:17 +0000 (15:54 +0100)
commit0a05f88e2bb33ed2a0cfd93f481f471efb7791aa
treecc33471786f99fc1788d2d8e0b5aa6f114fac582
parent2a330dba93ff11bc00eda76e9419bc52b0c7ead6
script/execute: Don't crash on a "for" loop with no items

The following crashes the parser:

  for x in; do
  0
  done

This is because grub_script_arglist_to_argv() doesn't consider the
possibility that arglist is NULL. Catch that explicitly.

This avoids a NULL pointer dereference.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/script/execute.c