dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone
f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Andrei Borzenkov <arvidjaar@gmail.com>
f725e3
Date: Sat, 9 Jan 2016 21:05:44 +0300
f725e3
Subject: [PATCH] mkimage: fix unintended sign extension
f725e3
f725e3
Found by: Coverity scan.
f725e3
CID: 73691, 73717
f725e3
---
f725e3
 util/grub-mkimagexx.c | 2 +-
f725e3
 1 file changed, 1 insertion(+), 1 deletion(-)
f725e3
f725e3
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
f725e3
index 0a1ac9e517c..66e8576411e 100644
f725e3
--- a/util/grub-mkimagexx.c
f725e3
+++ b/util/grub-mkimagexx.c
f725e3
@@ -1465,7 +1465,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
f725e3
   section_entsize = grub_target_to_host16 (e->e_shentsize);
f725e3
   num_sections = grub_target_to_host16 (e->e_shnum);
f725e3
 
f725e3
-  if (kernel_size < section_offset + section_entsize * num_sections)
f725e3
+  if (kernel_size < section_offset + (grub_uint32_t) section_entsize * num_sections)
f725e3
     grub_util_error (_("premature end of file %s"), kernel_path);
f725e3
 
f725e3
   sections = (Elf_Shdr *) (kernel_img + section_offset);