* grub-core/io/lzopio.c: Remove variable length arrays.

This commit is contained in:
Vladimir Serbinenko 2013-11-12 01:25:03 +01:00
parent 5ccaf90415
commit 9e34a34e44
2 changed files with 20 additions and 12 deletions

View file

@ -1,3 +1,7 @@
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/io/lzopio.c: Remove variable length arrays.
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/crypto.h: Add maximums on hash size and cipher block

View file

@ -166,15 +166,17 @@ read_block_data (struct grub_lzopio *lzopio)
if (lzopio->ccheck_fun)
{
GRUB_PROPERLY_ALIGNED_ARRAY (context, lzopio->ccheck_fun->contextsize);
grub_uint8_t computed_hash[GRUB_CRYPTO_MAX_MDLEN];
lzopio->ccheck_fun->init (context);
lzopio->ccheck_fun->write (context, lzopio->block.cdata,
if (lzopio->ccheck_fun->mdlen > GRUB_CRYPTO_MAX_MDLEN)
return -1;
grub_crypto_hash (lzopio->ccheck_fun, computed_hash,
lzopio->block.cdata,
lzopio->block.csize);
lzopio->ccheck_fun->final (context);
if (grub_memcmp
(lzopio->ccheck_fun->read (context), &lzopio->block.ccheck,
(computed_hash, &lzopio->block.ccheck,
sizeof (lzopio->block.ccheck)) != 0)
return -1;
}
@ -212,15 +214,17 @@ uncompress_block (struct grub_lzopio *lzopio)
if (lzopio->ucheck_fun)
{
GRUB_PROPERLY_ALIGNED_ARRAY (context, lzopio->ucheck_fun->contextsize);
grub_uint8_t computed_hash[GRUB_CRYPTO_MAX_MDLEN];
lzopio->ucheck_fun->init (context);
lzopio->ucheck_fun->write (context, lzopio->block.udata,
if (lzopio->ucheck_fun->mdlen > GRUB_CRYPTO_MAX_MDLEN)
return -1;
grub_crypto_hash (lzopio->ucheck_fun, computed_hash,
lzopio->block.udata,
lzopio->block.usize);
lzopio->ucheck_fun->final (context);
if (grub_memcmp
(lzopio->ucheck_fun->read (context), &lzopio->block.ucheck,
(computed_hash, &lzopio->block.ucheck,
sizeof (lzopio->block.ucheck)) != 0)
return -1;
}