loader/linux: Avoid overflow on initrd size calculation
Signed-off-by: Peter Jones <pjones@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
f7bd9986f6
commit
0dcbf3652b
|
@ -151,8 +151,7 @@ grub_initrd_init (int argc, char *argv[],
|
||||||
initrd_ctx->nfiles = 0;
|
initrd_ctx->nfiles = 0;
|
||||||
initrd_ctx->components = 0;
|
initrd_ctx->components = 0;
|
||||||
|
|
||||||
initrd_ctx->components = grub_zalloc (argc
|
initrd_ctx->components = grub_calloc (argc, sizeof (initrd_ctx->components[0]));
|
||||||
* sizeof (initrd_ctx->components[0]));
|
|
||||||
if (!initrd_ctx->components)
|
if (!initrd_ctx->components)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue