possible bug in sbin/fsck_msdosfs/boot.c

From: Alexander Best <alexbestms_at_math.uni-muenster.de>
Date: Thu, 23 Jul 2009 12:29:23 +0200 (CEST)
i just tried to do fsck_msdosfs on my mobile phone's memory card using a usb
connection cable. this is what `file -s` has to say about /dev/da0:

/dev/da0: x86 boot sector, code offset 0x0, OEM-ID "        ", sectors/cluster
64, reserved sectors 6304, Media descriptor 0xf8, heads 128, hidden sectors
8192, sectors 7736320 (volumes > 32 MB) , FAT (32 bit), sectors/FAT 944,
reserved3 0x800000, serial number 0x34613466, label: "mem        "

however after issuing the command `fsck_msdosfs /dev/da0` i got the following
error:

fsck_msdosfs /dev/da0
** /dev/da0
backup doesn't compare to primary bootblock

i did a bit of research and it seems this bug was supposed to be fixed by
r128463. the problem was that the entire bootblock was compared to the
backupblock. but since only the first 52 bytes of the bootblock are important
many device use the rest of the bootblock for some other purpose. the
following change was made to sbin/fsck_msdosfs/boot.c:

-- if (memcmp(block, backup, DOSBOOTBLOCKSIZE)) {
++ if (memcmp(block + 11, backup + 11, 79)) {

it seems however that the last memcmp argument is still too high. could
somebody with good fat12/16/32 knowledge please look into this?

i attached the original openbsd problem report which described the problem in
detail in 2006 (actually the problem was first discovered in 2001 but nobody
seemed to care about it back then).

cheers.
alex

oh...and i'm running r195774 (8.0-BETA2).

Received on Thu Jul 23 2009 - 08:29:31 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC