]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
grub-mkimage: fix potential NULL pointer dereference
authorAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 30 Jan 2015 19:26:05 +0000 (22:26 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 30 Jan 2015 19:26:05 +0000 (22:26 +0300)
Move fatal check whether symtab_section is NULL before first reference.

Found by: Coverity scan.

util/grub-mkimagexx.c

index 0a1ac9e517cc7d269c5460cf3b61bbf3efc65b78..3c76d0708cbe6d7047645fe20c85c3770391299b 100644 (file)
@@ -1539,6 +1539,8 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
            symtab_section = s;
            break;
          }
+      if (! symtab_section)
+       grub_util_error ("%s", _("no symbol table"));
 
 #ifdef MKIMAGE_ELF32
       if (image_target->elf_target == EM_ARM)
@@ -1577,8 +1579,6 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
        }
 #endif
 
-      if (! symtab_section)
-       grub_util_error ("%s", _("no symbol table"));
     }
   else
     {