Re: possible bug in sbin/fsck_msdosfs/boot.c

From: Alexander Best <alexbestms_at_math.uni-muenster.de>
Date: Fri, 24 Jul 2009 00:23:00 +0200 (CEST)
thanks a bunch.

Eygene Ryabinkin schrieb am 2009-07-23:
> Alexander, good day.

> Thu, Jul 23, 2009 at 12:29:23PM +0200, Alexander Best wrote:
> > 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?

> 79 looks sane for the FAT32, see
>   http://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html

> For FAT16/FAT12 the size should be 51.  Actually, what is now
> compared
> is the BIOS parameter block.  I'll take a look at the FS forensics
> book:
> my memory blocks with FAT remniscents are a bit rusty ;))
Received on Thu Jul 23 2009 - 20:23:02 UTC

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