* util/hostdisk.c (make_device_name): Do not make any assumptions

about the length of drive names.
This commit is contained in:
davem 2009-04-13 23:01:54 +00:00
parent 96bd81ecf9
commit 6a4737e5d8
2 changed files with 10 additions and 1 deletions

View File

@ -46,6 +46,9 @@
* conf/common.rmk (grub_probe_SOURCES): Add Sun partition module.
(grub_fstest_SOURCES): Likewise.
* util/hostdisk.c (make_device_name): Do not make any assumptions
about the length of drive names.
2009-04-12 David S. Miller <davem@davemloft.net>
* kern/misc.c (grub_ltoa): Fix cast when handling negative

View File

@ -622,9 +622,15 @@ grub_util_biosdisk_fini (void)
static char *
make_device_name (int drive, int dos_part, int bsd_part)
{
int len = strlen(map[drive].drive);
char *p;
p = xmalloc (30);
if (dos_part >= 0)
len += 1 + ((dos_part + 1) / 10);
if (bsd_part >= 0)
len += 2;
p = xmalloc (len);
sprintf (p, "%s", map[drive].drive);
if (dos_part >= 0)