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

Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Doug Ledford 2010-07-20 17:35:27 -04:00
parent 2913d9df16
commit 0155af90d8
1 changed files with 1 additions and 1 deletions

2
Grow.c
View File

@ -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);