make_device_name() uses an arbitrary value for the device name length, putting an arbitrary limit on such strings.
We can do better by calculating the length of this string precisely. 2009-04-12 David S. Miller <da...@davemloft.net> * util/hostdisk.c (make_device_name): Do not make any assumptions about the length of drive names. --- util/hostdisk.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/util/hostdisk.c b/util/hostdisk.c index 2ef2057..fd01a26 100644 --- a/util/hostdisk.c +++ b/util/hostdisk.c @@ -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) -- 1.6.2.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel