]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2010-01-27 Vladimir Serbinenko <phcoder@gmail.com>
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 27 Jan 2010 16:30:03 +0000 (17:30 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 27 Jan 2010 16:30:03 +0000 (17:30 +0100)
* kern/disk.c (grub_disk_read): Fix offset computation when reading
last sectors.

ChangeLog
kern/disk.c

index aceb55009b481013e3766020eeef0399862276dd..ba4a7d7e3978b339fd0f4a60928df9219111363a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * kern/disk.c (grub_disk_read): Fix offset computation when reading
+       last sectors.
+
 2010-01-27  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * commands/hashsum.c (hash_file): Avoid possible stack overflow by
index 075838d1e5c9ee4e2585650c3b3db3522ab389f4..a01373072baf3d297722b217da6722743c29ce27 100644 (file)
@@ -441,7 +441,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
 
              grub_errno = GRUB_ERR_NONE;
 
-             num = ((size + GRUB_DISK_SECTOR_SIZE - 1)
+             num = ((size + real_offset + pos + GRUB_DISK_SECTOR_SIZE - 1)
                     >> GRUB_DISK_SECTOR_BITS);
 
              p = grub_realloc (tmp_buf, num << GRUB_DISK_SECTOR_BITS);
@@ -458,7 +458,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
                  goto finish;
                }
 
-             grub_memcpy (buf, tmp_buf + real_offset, size);
+             grub_memcpy (buf, tmp_buf + pos + real_offset, size);
 
              /* Call the read hook, if any.  */
              if (disk->read_hook)