* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-22 08:38:17 +02:00
parent 937d1c44b1
commit 4cf6be1bd9
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/reiserfs.c (grub_reiserfs_iterate_dir): Fix size byteswap

View file

@ -856,7 +856,7 @@ grub_squash_read_data (struct grub_squash_data *data,
if (err)
return -1;
a += grub_le_to_cpu64 (frag.offset);
compressed = !(frag.size & SQUASH_BLOCK_UNCOMPRESSED);
compressed = !(frag.size & grub_cpu_to_le32_compile_time (SQUASH_BLOCK_UNCOMPRESSED));
if (ino->ino.type == grub_cpu_to_le16_compile_time (SQUASH_TYPE_LONG_REGULAR))
b = grub_le_to_cpu32 (ino->ino.long_file.offset) + off;
else
@ -866,19 +866,20 @@ grub_squash_read_data (struct grub_squash_data *data,
if (compressed)
{
char *block;
block = grub_malloc (frag.size);
block = grub_malloc (grub_le_to_cpu32 (frag.size));
if (!block)
return -1;
err = grub_disk_read (data->disk,
a >> GRUB_DISK_SECTOR_BITS,
a & (GRUB_DISK_SECTOR_SIZE - 1),
frag.size, block);
grub_le_to_cpu32 (frag.size), block);
if (err)
{
grub_free (block);
return -1;
}
if (data->decompress (block, frag.size, b, buf, len, data)
if (data->decompress (block, grub_le_to_cpu32 (frag.size),
b, buf, len, data)
!= (grub_ssize_t) len)
{
grub_free (block);