]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
tarfs: Fix checksum calculation.
authorDag-Erling Smørgrav <des@FreeBSD.org>
Wed, 6 Mar 2024 16:14:01 +0000 (17:14 +0100)
committerDag-Erling Smørgrav <des@FreeBSD.org>
Wed, 6 Mar 2024 16:14:01 +0000 (17:14 +0100)
commit0118b0c8e58a438a931a5ce1bf8d7ae6208cc61b
tree32fcecba11a2835d8f04b9607f465b0b5275ff7c
parente212f0c0666e7d3a24dce03b8c88920d14b80e47
tarfs: Fix checksum calculation.

The checksum code assumed that struct ustar_header filled an entire
block and calculcated the checksum based on the size of the structure.
The header is in fact only 500 bytes long while the checksum covers
the entire block (“logical record” in POSIX terms).  Add padding and
an assertion, and clean up the checksum code.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44226
sys/fs/tarfs/tarfs_vfsops.c
tests/sys/fs/tarfs/tarfs_test.sh