Hi,

When the argument passed to grub_disk_open is a string containing a
partition, e.g. "hd0,msdos3,bsd7", disk->name is set to the full
string instead of just the prefix up to the first ',' (here "hd0").
This leads to incorrect partition identifiers when the disk name and
the partition name are concatenated (I observed this in the debug
messages of my nested partitions patch).

The attached patch fixes this issue.

Grégoire
=== modified file 'kern/disk.c'
--- kern/disk.c 2010-02-07 00:48:38 +0000
+++ kern/disk.c 2010-07-09 16:44:06 +0000
@@ -248,11 +248,16 @@ grub_disk_open (const char *name)
   if (! disk)
     return 0;
 
-  disk->name = grub_strdup (name);
+  p = find_part_sep (name);
+
+  if (p)
+    disk->name = grub_strndup (name, p - name);
+  else
+    disk->name = grub_strdup (name);
+
   if (! disk->name)
     goto fail;
 
-  p = find_part_sep (name);
   if (p)
     {
       grub_size_t len = p - name;

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to