Only copy as much bytes as there in superblock, instead of the full

block copy, when copying the superblock into the snapshot.  UFS1 does
not align superblock on the block boundary, and bcopy runs off the end
of the buffer.

Reported by:	Andre Albsmeier <Andre.Albsmeier@siemens.com>
Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
kib 2013-07-12 18:52:33 +00:00
parent 9b5eb8f860
commit d323dc8e3a

View File

@ -792,7 +792,7 @@ out1:
brelse(nbp);
} else {
loc = blkoff(fs, fs->fs_sblockloc);
bcopy((char *)copy_fs, &nbp->b_data[loc], fs->fs_bsize);
bcopy((char *)copy_fs, &nbp->b_data[loc], (u_int)fs->fs_sbsize);
bawrite(nbp);
}
/*