]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Bugfix: don't issue a read larger than the buffer to hold it
authorDoug Ledford <dledford@redhat.com>
Tue, 20 Jul 2010 21:35:27 +0000 (17:35 -0400)
committerDoug Ledford <dledford@redhat.com>
Thu, 22 Jul 2010 14:16:31 +0000 (10:16 -0400)
Signed-off-by: Doug Ledford <dledford@redhat.com>
Grow.c

diff --git a/Grow.c b/Grow.c
index 3923a90fded10dd1dd050101b7f7d40bc41b08b2..dd05d4d988a89dc3decca48fd1f5223a16949989 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -1820,7 +1820,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
                }
                /* There should be a duplicate backup superblock 4k before here */
                if (lseek64(fd, -4096, 1) < 0 ||
-                   read(fd, &bsb2, 4096) != 4096)
+                   read(fd, &bsb2, sizeof(bsb2)) != sizeof(bsb2))
                        goto second_fail; /* Cannot find leading superblock */
                if (bsb.magic[15] == '1')
                        bsbsize = offsetof(struct mdp_backup_super, pad1);