* 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

@ -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)