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:
Konstantin Belousov 2013-07-12 18:52:33 +00:00
parent 008ac71e0a
commit 2aea094f65
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253280

View File

@ -792,7 +792,7 @@ ffs_snapshot(mp, snapfile)
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);
}
/*