]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Avoid straying into first partition when embedding-area sectors are in use (LP: ...
authorColin Watson <cjwatson@ubuntu.com>
Mon, 14 Mar 2011 21:41:24 +0000 (21:41 +0000)
committerColin Watson <cjwatson@ubuntu.com>
Mon, 14 Mar 2011 21:41:24 +0000 (21:41 +0000)
grub-core/partmap/msdos.c

index cb836d17110e7a1689b2c461f9afb7ab02afdaae..c6340a2311effeadba996dd37d4ec0c156cf4c34 100644 (file)
@@ -275,7 +275,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
     {
       int i, j;
       char *embed_signature_check;
-      unsigned int orig_nsectors, extra_sectors = 0;
+      unsigned int orig_nsectors;
 
       orig_nsectors = *nsectors;
       *nsectors = end - 1;
@@ -307,7 +307,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
                          "future.  Please ask its authors not to store data "
                          "in the boot track",
                          (*sectors)[i], embed_signatures[j].name);
-         extra_sectors++;
+         (*nsectors)--;
 
          /* Avoid this sector.  */
          for (j = i; j < *nsectors; j++)
@@ -315,7 +315,7 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
        }
       grub_free (embed_signature_check);
 
-      if (end + extra_sectors < orig_nsectors + 1)
+      if (*nsectors < orig_nsectors)
        return grub_error (GRUB_ERR_OUT_OF_RANGE,
                           "Other software is using the embedding area, and "
                           "there is not enough room for core.img.  Such "