]> git.proxmox.com Git - grub2.git/commitdiff
efiemu: fix unintended sign extension
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 07:53:31 +0000 (10:53 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 08:36:42 +0000 (11:36 +0300)
Found by: Coverity scan.
CID: 73883, 73637

grub-core/efiemu/loadcore.c

index 6968b3719cab557e4975a54935c90d3f49b4bf64..e68e7e4d1606b120a2d2ea3ab4760b1f7af59d2f 100644 (file)
@@ -343,7 +343,7 @@ SUFFIX (grub_efiemu_loadcore_init) (void *core, const char *filename,
     return grub_error (GRUB_ERR_BAD_MODULE, N_("this ELF file is not of the right type"));
 
   /* Make sure that every section is within the core.  */
-  if ((grub_size_t) core_size < e->e_shoff + e->e_shentsize * e->e_shnum)
+  if ((grub_size_t) core_size < e->e_shoff + (grub_uint32_t) e->e_shentsize * e->e_shnum)
     return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
                       filename);