]> git.proxmox.com Git - grub2.git/commitdiff
setup: fix NULL pointer dereference
authorAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 18:25:22 +0000 (21:25 +0300)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Sat, 9 Jan 2016 18:25:22 +0000 (21:25 +0300)
Check return value of grub_guess_root_devices

Found by: Coverity scan.
CID: 73638, 73751

util/setup.c

index d74567d0a7e8d25b7e44a96fdf348a35073e2f52..8aa5a39a79465c33b0ff6a5a6b1bc82128df2e18 100644 (file)
@@ -312,6 +312,9 @@ SETUP (const char *dir,
     char **cur;
     int found = 0;
 
+    if (!root_devices)
+      grub_util_error (_("cannot find a device for %s (is /dev mounted?)"), dir);
+
     for (cur = root_devices; *cur; cur++)
       {
        char *drive;