bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Check --boot-drive argument


From: Pavel Roskin
Subject: [PATCH] Check --boot-drive argument
Date: Tue, 02 May 2006 00:29:48 -0400

Hello!

grub shell crashes if the argument to --boot-drive exceeds 255.


2006-05-02  Pavel Roskin  <address@hidden>

        * grub/main.c (main): Don't allow boot drives exceeding our
        limit of 256.  Using higher numbers will crash grub.

diff -u -r1.23 main.c
--- grub/main.c 11 Jun 2002 16:36:54 -0000      1.23
+++ grub/main.c 2 May 2006 03:25:24 -0000
@@ -32,6 +32,7 @@
 #define WITHOUT_LIBC_STUBS 1
 #include <shared.h>
 #include <term.h>
+#include <device.h>
 
 char *program_name = 0;
 int use_config_file = 1;
@@ -192,6 +193,12 @@
              perror ("strtoul");
              exit (1);
            }
+         if (boot_drive >= NUM_DISKS)
+           {
+             fprintf (stderr, "boot_drive should be from 0 to %d\n",
+                      NUM_DISKS - 1);
+             exit (1);
+           }
          break;
 
        case OPT_NO_CONFIG_FILE:


-- 
Regards,
Pavel Roskin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]