From: Doug Ledford Date: Tue, 20 Jul 2010 21:35:27 +0000 (-0400) Subject: Bugfix: don't issue a read larger than the buffer to hold it X-Git-Tag: mdadm-3.1.3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0155af90d8352d3ca031347e75854b3a5a4052ac;p=thirdparty%2Fmdadm.git Bugfix: don't issue a read larger than the buffer to hold it Signed-off-by: Doug Ledford --- diff --git a/Grow.c b/Grow.c index 3923a90f..dd05d4d9 100644 --- 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);