* grub-core/kern/emu/hostdisk.c (find_partition_start)

[HAVE_DIOCGDINFO]: Add safety checks.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-03-29 15:00:23 +02:00
parent a307c0b206
commit 9e4d19e0d3
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/kern/emu/hostdisk.c (find_partition_start)
[HAVE_DIOCGDINFO]: Add safety checks.
2011-03-29 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_kfreebsd.in: Allow ufs.ko to be missing as it's

View file

@ -518,9 +518,12 @@ devmapper_fail:
# if !defined(HAVE_DIOCGDINFO)
return hdg.start;
# else /* defined(HAVE_DIOCGDINFO) */
p_index = dev[strlen(dev) - 1] - 'a';
if (p_index >= label.d_npartitions)
if (dev[0])
p_index = dev[strlen(dev) - 1] - 'a';
else
p_index = -1;
if (p_index >= label.d_npartitions || p_index < 0)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", dev);