mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 06:49:35 +00:00
Initialized initrd_ctx so we don't free a random pointer from the stack.
Currently, if "linux" fails, the "goto fail;" in grub_cmd_initrd sends us into grub_initrd_close() without grub_initrd_init() being called, and thus it never clears initrd_ctx->components. grub_initrd_close() then frees that address, which is stale data from the stack. If the stack happens to have a stale *address* there that matches a recent allocation, then you'll get a double free later. So initialize the memory up front. Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
1 parent
60049a0e72
commit
631a820038
9 files changed
+20
-8
No files matched your search
@@ -373,7 +373,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_addr_t paddr;
|
||||
grub_addr_t addr;
|
||||
int ret;
|
||||
struct grub_linux_initrd_context initrd_ctx;
|
||||
struct grub_linux_initrd_context initrd_ctx = { 0, };
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user