123456789101112131415161718192021222324252627282930313233343536373839 |
- From 239a16a303228574f61a82c6fbb041688dff65d0 Mon Sep 17 00:00:00 2001
- From: Lidong Chen <lidong.chen@oracle.com>
- Date: Fri, 22 Nov 2024 06:27:55 +0000
- Subject: [PATCH] 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 <nils@langius.de>
- Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
- Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
- Reviewed-by: Alec Brown <alec.r.brown@oracle.com>
- Upstream: 05be856a8c3aae41f5df90cab7796ab7ee34b872
- Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
- ---
- grub-core/commands/extcmd.c | 3 +++
- 1 file changed, 3 insertions(+)
- diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c
- index 90a5ca24a..c236be13a 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;
- --
- 2.50.1
|