Doug Ledford: Bugfix: don't issue a read larger than the buffer to hold it

Martin F. Krafft madduck at alioth.debian.org
Sun Aug 29 11:55:45 UTC 2010


Module: mdadm
Branch: upstream
Commit: 0155af90d8352d3ca031347e75854b3a5a4052ac
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=0155af90d8352d3ca031347e75854b3a5a4052ac

Author: Doug Ledford <dledford at redhat.com>
Date:   Tue Jul 20 17:35:27 2010 -0400

Bugfix: don't issue a read larger than the buffer to hold it

Signed-off-by: Doug Ledford <dledford at redhat.com>

---

 Grow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Grow.c b/Grow.c
index 3923a90..dd05d4d 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);




More information about the pkg-mdadm-commits mailing list