* grub-core/fs/affs.c (grub_affs_label): Interpret label as latin1.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-25 22:07:15 +01:00
parent 0108f49101
commit 2ae254de13
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2011-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/affs.c (grub_affs_label): Interpret label as latin1.
2011-12-25 Vladimir Serbinenko <phcoder@gmail.com> 2011-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu.c (menu_init): Don't stop menu init at gfxterm. * grub-core/normal/menu.c (menu_init): Don't stop menu init at gfxterm.

View file

@ -526,6 +526,7 @@ grub_affs_label (grub_device_t device, char **label)
data = grub_affs_mount (disk); data = grub_affs_mount (disk);
if (data) if (data)
{ {
grub_size_t len;
/* The rootblock maps quite well on a file header block, it's /* The rootblock maps quite well on a file header block, it's
something we can use here. */ something we can use here. */
grub_disk_read (data->disk, grub_be_to_cpu32 (data->bblock.rootblock), grub_disk_read (data->disk, grub_be_to_cpu32 (data->bblock.rootblock),
@ -535,7 +536,10 @@ grub_affs_label (grub_device_t device, char **label)
if (grub_errno) if (grub_errno)
return 0; return 0;
*label = grub_strndup ((char *) (file.name), file.namelen); len = grub_min (file.namelen, sizeof (file.name));
*label = grub_malloc (len * GRUB_MAX_UTF8_PER_LATIN1 + 1);
if (*label)
*grub_latin1_to_utf8 ((grub_uint8_t *) *label, file.name, len) = '\0';
} }
else else
*label = 0; *label = 0;