]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 22 May 2012 06:38:17 +0000 (08:38 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 22 May 2012 06:38:17 +0000 (08:38 +0200)
ChangeLog
grub-core/fs/squash4.c

index 957b1410479756a4d5729618bb893c8d2103ef12..b064e6c310f4f5e83ae25a84b2002b61f267ee1d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 6516c6287b2f0d1650a126a53e927563bbc980ba..c46d29e69fa0101a1aa6bd9c59bbd197913fa276 100644 (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);