* 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:
parent
dc71319397
commit
9b4baaa4ee
2 changed files with 13 additions and 7 deletions
|
@ -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>
|
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Force inlining of
|
* grub-core/fs/iso9660.c (grub_iso9660_iterate_dir): Force inlining of
|
||||||
|
|
|
@ -331,19 +331,20 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node, grub_off_t off,
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
grub_iso9660_convert_string (grub_uint16_t *us, int len)
|
grub_iso9660_convert_string (grub_uint8_t *us, int len)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
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)
|
if (! p)
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
for (i=0; i<len; i++)
|
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;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -746,7 +747,7 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
|
||||||
|
|
||||||
oldname = filename;
|
oldname = filename;
|
||||||
filename = grub_iso9660_convert_string
|
filename = grub_iso9660_convert_string
|
||||||
((grub_uint16_t *) oldname, dirent.namelen >> 1);
|
((grub_uint8_t *) oldname, dirent.namelen >> 1);
|
||||||
|
|
||||||
semicolon = grub_strrchr (filename, ';');
|
semicolon = grub_strrchr (filename, ';');
|
||||||
if (semicolon)
|
if (semicolon)
|
||||||
|
@ -978,8 +979,7 @@ grub_iso9660_label (grub_device_t device, char **label)
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
if (data->joliet)
|
if (data->joliet)
|
||||||
*label = grub_iso9660_convert_string
|
*label = grub_iso9660_convert_string (data->voldesc.volname, 16);
|
||||||
((grub_uint16_t *) &data->voldesc.volname, 16);
|
|
||||||
else
|
else
|
||||||
*label = grub_strndup ((char *) data->voldesc.volname, 32);
|
*label = grub_strndup ((char *) data->voldesc.volname, 32);
|
||||||
if (*label)
|
if (*label)
|
||||||
|
|
Loading…
Reference in a new issue