* grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys.

(grub_hfs_iterate_dir): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-13 23:10:38 +01:00
parent 12e9d4d152
commit b453412d2f
2 changed files with 7 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys.
(grub_hfs_iterate_dir): Likewise.
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com> 2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
Fix video on platforms where unaligned access is forbidden. Fix video on platforms where unaligned access is forbidden.

View file

@ -750,10 +750,7 @@ grub_hfs_find_node (struct grub_hfs_data *data, char *key,
entry. In case of a non-leaf mode it will be used to lookup entry. In case of a non-leaf mode it will be used to lookup
the rest of the tree. */ the rest of the tree. */
if (cmp <= 0) if (cmp <= 0)
{ found = grub_be_to_cpu32 (grub_get_unaligned32 (rec->data));
grub_uint32_t *node = (grub_uint32_t *) rec->data;
found = grub_be_to_cpu32 (*node);
}
else /* The key can not be found in the tree. */ else /* The key can not be found in the tree. */
return 1; return 1;
@ -817,7 +814,7 @@ grub_hfs_iterate_dir (struct grub_hfs_data *data, grub_uint32_t root_idx,
struct grub_hfs_catalog_key *ckey = rec->key; struct grub_hfs_catalog_key *ckey = rec->key;
if (grub_hfs_cmp_catkeys (rec->key, (void *) &key) <= 0) if (grub_hfs_cmp_catkeys (rec->key, (void *) &key) <= 0)
found = grub_be_to_cpu32 (*(grub_uint32_t *) rec->data); found = grub_be_to_cpu32 (grub_get_unaligned32 (rec->data));
if (hnd->type == 0xFF && ckey->strlen > 0) if (hnd->type == 0xFF && ckey->strlen > 0)
{ {