On Fri, Dec 01, 2023 at 06:54:48AM +0000, Miod Vallat wrote:
> > It always chokes on fp->fsisig4.
> 
> Well, that's what you get from reading 512 bytes and casting the buffer
> to a 1024 byte struct.
> 
> The following diff ought to solve this.

Makes sense, works for me, thanks.
OK kn

> 
> Index: msdos/msdosfs_vfsops.c
> ===================================================================
> RCS file: /OpenBSD/src/usr.sbin/makefs/msdos/msdosfs_vfsops.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 msdosfs_vfsops.c
> --- msdos/msdosfs_vfsops.c    6 Oct 2021 00:40:41 -0000       1.13
> +++ msdos/msdosfs_vfsops.c    1 Dec 2023 06:52:40 -0000
> @@ -278,7 +278,8 @@ msdosfs_mount(struct mkfsvnode *devvp, i
>               DPRINTF(("%s(bread %lu)\n", __func__,
>                   (unsigned long)de_bn2kb(pmp, pmp->pm_fsinfo)));
>               if ((error = bread(devvp, de_bn2kb(pmp, pmp->pm_fsinfo),
> -                 pmp->pm_BytesPerSec, 0, &bp)) != 0)
> +                 roundup(sizeof(struct fsinfo), pmp->pm_BytesPerSec),
> +                 0, &bp)) != 0)
>                       goto error_exit;
>               fp = (struct fsinfo *)bp->b_data;
>               if (!memcmp(fp->fsisig1, "RRaA", 4)

Reply via email to