fstyp can misidentify a UFS file system as MSDOS when the partition was
originally created as MSDOS.
The misidentification happens for the following reasons:
- initial signature header for an MSDOS file system is read from offset 0 plus 512 bytes
- the superblock for UFS is read from offset 64k, 8k, 0k, or 256k plus 8192 bytes
- newfs does not clear the area before writing UFS's superblock
- fstyp searches for file systems labels alphabetically
Given the above, the false positive happens because fstyp detects the
MSDOS file system because newfs leaves the MSDOS label intact and MSDOS
is checked before UFS in fstyp's ordering list.
To avoid this false positive, reorder fstyp's label search list by
largest offset instead of alphabetically.
The implemented fix was suggested by reporter, Richard M. Kreuter.
PR: 252787