diff --git a/ChangeLog b/ChangeLog index aa3843db0..c64c63b48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-12-25 Vladimir Serbinenko + + * grub-core/fs/affs.c (grub_affs_label): Interpret label as latin1. + 2011-12-25 Vladimir Serbinenko * grub-core/normal/menu.c (menu_init): Don't stop menu init at gfxterm. diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c index 0ad5e6672..b551cfcdb 100644 --- a/grub-core/fs/affs.c +++ b/grub-core/fs/affs.c @@ -526,6 +526,7 @@ grub_affs_label (grub_device_t device, char **label) data = grub_affs_mount (disk); if (data) { + grub_size_t len; /* The rootblock maps quite well on a file header block, it's something we can use here. */ 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) 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 *label = 0;