]> git.ipfire.org Git - thirdparty/grub.git/commit
script/execute: Fix potential underflow and NULL dereference
authorLidong Chen <lidong.chen@oracle.com>
Wed, 29 Jan 2025 06:48:37 +0000 (06:48 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 13 Feb 2025 14:45:57 +0000 (15:45 +0100)
commitd13b6e8ebd10b4eb16698a002aa40258cf6e6f0e
treea093a4682936b22f51561dda8792f4081884fe39
parente3c578a56f9294e286b6028ca7c1def997a17b15
script/execute: Fix potential underflow and NULL dereference

The result is initialized to 0 in grub_script_arglist_to_argv().
If the for loop condition is not met both result.args and result.argc
remain 0 causing result.argc - 1 to underflow and/or result.args NULL
dereference. Fix the issues by adding relevant checks.

Fixes: CID 473880
Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/script/execute.c