* grub-core/fs/affs.c (grub_affs_read_block): Fix theoretical overflow.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-06 16:18:00 +02:00
parent 83b2e89cf7
commit 62ace64dd9
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2012-05-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/affs.c (grub_affs_read_block): Fix theoretical overflow.
2012-05-06 Vladimir Serbinenko <phcoder@gmail.com> 2012-05-06 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/ls.c (grub_ls_list_files): Fix overflow. * grub-core/commands/ls.c (grub_ls_list_files): Fix overflow.

View file

@ -129,8 +129,8 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (!node->block_cache) if (!node->block_cache)
{ {
node->block_cache = grub_malloc ((((grub_be_to_cpu32 (node->di.size) node->block_cache = grub_malloc (((grub_be_to_cpu32 (node->di.size)
+ 511) >> 9) / data->htsize + 1) >> 9) / data->htsize + 2)
* sizeof (node->block_cache[0])); * sizeof (node->block_cache[0]));
if (!node->block_cache) if (!node->block_cache)
return -1; return -1;