* grub-core/fs/iso9660.c (grub_iso9660_convert_string): Make first

argument a u8 pointer. All users updated.
	Handle unaligned buffers.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-13 16:35:12 +01:00
parent dc71319397
commit 9b4baaa4ee
2 changed files with 13 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/iso9660.c (grub_iso9660_convert_string): Make first
argument a u8 pointer. All users updated.
Handle unaligned buffers.
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Force inlining of

View file

@ -331,19 +331,20 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node, grub_off_t off,
}
static char *
grub_iso9660_convert_string (grub_uint16_t *us, int len)
grub_iso9660_convert_string (grub_uint8_t *us, int len)
{
char *p;
int i;
grub_uint16_t t[len];
p = grub_malloc (len * 4 + 1);
p = grub_malloc (len * GRUB_MAX_UTF8_PER_UTF16 + 1);
if (! p)
return p;
for (i=0; i<len; i++)
us[i] = grub_be_to_cpu16 (us[i]);
t[i] = grub_be_to_cpu16 (grub_get_unaligned16 (us + 2 * i));
*grub_utf16_to_utf8 ((grub_uint8_t *) p, us, len) = '\0';
*grub_utf16_to_utf8 ((grub_uint8_t *) p, t, len) = '\0';
return p;
}
@ -746,7 +747,7 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
oldname = filename;
filename = grub_iso9660_convert_string
((grub_uint16_t *) oldname, dirent.namelen >> 1);
((grub_uint8_t *) oldname, dirent.namelen >> 1);
semicolon = grub_strrchr (filename, ';');
if (semicolon)
@ -978,8 +979,7 @@ grub_iso9660_label (grub_device_t device, char **label)
if (data)
{
if (data->joliet)
*label = grub_iso9660_convert_string
((grub_uint16_t *) &data->voldesc.volname, 16);
*label = grub_iso9660_convert_string (data->voldesc.volname, 16);
else
*label = grub_strndup ((char *) data->voldesc.volname, 32);
if (*label)