From 62ace64dd9d50d723a5f1e8a825b2077800c46a9 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 6 May 2012 16:18:00 +0200 Subject: [PATCH] * grub-core/fs/affs.c (grub_affs_read_block): Fix theoretical overflow. --- ChangeLog | 4 ++++ grub-core/fs/affs.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a4a9bf0a..7dcc83ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-05-06 Vladimir Serbinenko + + * grub-core/fs/affs.c (grub_affs_read_block): Fix theoretical overflow. + 2012-05-06 Vladimir Serbinenko * grub-core/commands/ls.c (grub_ls_list_files): Fix overflow. diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c index 50ab8026b..bcb630b6c 100644 --- a/grub-core/fs/affs.c +++ b/grub-core/fs/affs.c @@ -129,8 +129,8 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) if (!node->block_cache) { - node->block_cache = grub_malloc ((((grub_be_to_cpu32 (node->di.size) - + 511) >> 9) / data->htsize + 1) + node->block_cache = grub_malloc (((grub_be_to_cpu32 (node->di.size) + >> 9) / data->htsize + 2) * sizeof (node->block_cache[0])); if (!node->block_cache) return -1;