29 lines
937 B
Diff
29 lines
937 B
Diff
|
|
From cb79f0455946270ddaf6b098d8cd71b39f840edc Mon Sep 17 00:00:00 2001
|
||
|
|
From: Peter Jones <pjones@redhat.com>
|
||
|
|
Date: Fri, 24 Jul 2020 13:57:27 -0400
|
||
|
|
Subject: [PATCH 26/27] loader/linux: Avoid overflow on initrd size calculation
|
||
|
|
|
||
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||
|
|
---
|
||
|
|
grub-core/loader/linux.c | 3 +--
|
||
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
||
|
|
index 471b214..4cd8c20 100644
|
||
|
|
--- a/grub-core/loader/linux.c
|
||
|
|
+++ b/grub-core/loader/linux.c
|
||
|
|
@@ -151,8 +151,7 @@ grub_initrd_init (int argc, char *argv[],
|
||
|
|
initrd_ctx->nfiles = 0;
|
||
|
|
initrd_ctx->components = 0;
|
||
|
|
|
||
|
|
- initrd_ctx->components = grub_zalloc (argc
|
||
|
|
- * sizeof (initrd_ctx->components[0]));
|
||
|
|
+ initrd_ctx->components = grub_calloc (argc, sizeof (initrd_ctx->components[0]));
|
||
|
|
if (!initrd_ctx->components)
|
||
|
|
return grub_errno;
|
||
|
|
|
||
|
|
--
|
||
|
|
2.23.0
|
||
|
|
|