From: Lidong Chen Date: Fri, 22 Nov 2024 06:27:55 +0000 (+0000) Subject: commands/extcmd: Missing check for failed allocation X-Git-Tag: archive/raspbian/2.12-8+rpi1^2~42 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aec56395e6ace5c9ce9027396763f771284bc8b9;p=grub2.git commands/extcmd: Missing check for failed allocation The grub_extcmd_dispatcher() calls grub_arg_list_alloc() to allocate a grub_arg_list struct but it does not verify the allocation was successful. In case of failed allocation the NULL state pointer can be accessed in parse_option() through grub_arg_parse() which may lead to a security issue. Fixes: CVE-2024-45775 Reported-by: Nils Langius Signed-off-by: Lidong Chen Reviewed-by: Daniel Kiper Reviewed-by: Alec Brown Gbp-Pq: Topic cve-2025-jan Gbp-Pq: Name commands-extcmd-Missing-check-for-failed-allocation.patch --- diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c index 90a5ca2..c236be1 100644 --- a/grub-core/commands/extcmd.c +++ b/grub-core/commands/extcmd.c @@ -49,6 +49,9 @@ grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args, } state = grub_arg_list_alloc (ext, argc, args); + if (state == NULL) + return grub_errno; + if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc)) { context.state = state;