mkimage: fix unintended sign extension
Found by: Coverity scan. CID: 73691, 73717
This commit is contained in:
parent
dc27d254f2
commit
670c43af27
1 changed files with 1 additions and 1 deletions
|
@ -1465,7 +1465,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
||||||
section_entsize = grub_target_to_host16 (e->e_shentsize);
|
section_entsize = grub_target_to_host16 (e->e_shentsize);
|
||||||
num_sections = grub_target_to_host16 (e->e_shnum);
|
num_sections = grub_target_to_host16 (e->e_shnum);
|
||||||
|
|
||||||
if (kernel_size < section_offset + section_entsize * num_sections)
|
if (kernel_size < section_offset + (grub_uint32_t) section_entsize * num_sections)
|
||||||
grub_util_error (_("premature end of file %s"), kernel_path);
|
grub_util_error (_("premature end of file %s"), kernel_path);
|
||||||
|
|
||||||
sections = (Elf_Shdr *) (kernel_img + section_offset);
|
sections = (Elf_Shdr *) (kernel_img + section_offset);
|
||||||
|
|
Loading…
Reference in a new issue