0027-loader-linux-Avoid-overflow-on-initrd-size-calculati.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. From a2a7464e9f10a677d6f91e1c4fa527d084c22e7c Mon Sep 17 00:00:00 2001
  2. From: Peter Jones <pjones@redhat.com>
  3. Date: Fri, 24 Jul 2020 13:57:27 -0400
  4. Subject: [PATCH] loader/linux: Avoid overflow on initrd size calculation
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Signed-off-by: Peter Jones <pjones@redhat.com>
  9. Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
  10. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
  11. ---
  12. grub-core/loader/linux.c | 3 +--
  13. 1 file changed, 1 insertion(+), 2 deletions(-)
  14. diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
  15. index 471b214d6..4cd8c20c7 100644
  16. --- a/grub-core/loader/linux.c
  17. +++ b/grub-core/loader/linux.c
  18. @@ -151,8 +151,7 @@ grub_initrd_init (int argc, char *argv[],
  19. initrd_ctx->nfiles = 0;
  20. initrd_ctx->components = 0;
  21. - initrd_ctx->components = grub_zalloc (argc
  22. - * sizeof (initrd_ctx->components[0]));
  23. + initrd_ctx->components = grub_calloc (argc, sizeof (initrd_ctx->components[0]));
  24. if (!initrd_ctx->components)
  25. return grub_errno;
  26. --
  27. 2.26.2