From b453412d2f6a279b35eb6a01d4d1ae13021abdca Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 13 Dec 2011 23:10:38 +0100 Subject: [PATCH] * grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys. (grub_hfs_iterate_dir): Likewise. --- ChangeLog | 5 +++++ grub-core/fs/hfs.c | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2134b481a..936e64c45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-12-13 Vladimir Serbinenko + + * grub-core/fs/hfs.c (grub_hfs_find_node): Handle unaligned keys. + (grub_hfs_iterate_dir): Likewise. + 2011-12-13 Vladimir Serbinenko Fix video on platforms where unaligned access is forbidden. diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c index 973a2d2ef..6c5c4da3e 100644 --- a/grub-core/fs/hfs.c +++ b/grub-core/fs/hfs.c @@ -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 the rest of the tree. */ if (cmp <= 0) - { - grub_uint32_t *node = (grub_uint32_t *) rec->data; - found = grub_be_to_cpu32 (*node); - } + found = grub_be_to_cpu32 (grub_get_unaligned32 (rec->data)); else /* The key can not be found in the tree. */ 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; 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) {