opnsense-src/usr.sbin/fstyp
Robert Wing 6830340cfa fstyp: search for file system headers with the largest offset first
fstyp can misidentify a UFS file system as MS-DOS if the device was
repurposed from MS-DOS to UFS via newfs.

This happens for the following reasons:
    - the header for MS-DOS begins at offset 0
    - the superblock for UFS begins at offset 64k, 8k, 0k, or 256k
    - newfs does not clear the area in front of UFS's superblock,
      leaving the MS-DOS header intact.
    - fstyp searches for file system headers alphabetically

To avoid this misidentification, have fstyp search for file system
headers with the largest offset first instead of alphabetically.

The implemented fix was suggested by reporter, Richard M. Kreuter.

PR:             252787
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D47855
2024-12-03 23:45:09 -09:00
..
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
apfs.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
befs.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
cd9660.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
exfat.c usr.sbin: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00
ext2fs.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
fstyp.8 man filesystems: fix xrefs after move to section 4 2024-05-16 10:25:29 -06:00
fstyp.c fstyp: search for file system headers with the largest offset first 2024-12-03 23:45:09 -09:00
fstyp.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
geli.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
hammer.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
hammer2.c fstyp: Fix some memory safety bugs 2024-10-28 15:03:53 +00:00
hammer2_disk.h usr.sbin: Remove repeated words 2024-04-11 11:53:37 -06:00
hammer_disk.h Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:23 -06:00
hfsplus.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
Makefile zfs: merge openzfs/zfs@b10992582 2024-09-09 18:13:02 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
msdosfs.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
msdosfs.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
ntfs.c fstyp: Fix some memory safety bugs 2024-10-28 15:03:53 +00:00
ufs.c usr.sbin: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00
zfs.c usr.sbin: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:01 -07:00