nalika / rpms / grub2

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