Date: Fri, 13 Jul 2018 02:02:16 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336236 - head/sbin/fsck_msdosfs Message-ID: <201807130202.w6D22GJ4035338@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Fri Jul 13 02:02:16 2018 New Revision: 336236 URL: https://svnweb.freebsd.org/changeset/base/336236 Log: Detect and handle invalid number of FATs If the number of FATs field in the boot sector is zero, give an appropriate error code. Obtained from: Android https://android.googlesource.com/platform/external/fsck_msdos/+/6c29bbe8d58e6fe8755935a04166ecf82ff31f47%5E%21/ MFC after: 2 weeks Modified: head/sbin/fsck_msdosfs/boot.c Modified: head/sbin/fsck_msdosfs/boot.c ============================================================================== --- head/sbin/fsck_msdosfs/boot.c Fri Jul 13 00:37:47 2018 (r336235) +++ head/sbin/fsck_msdosfs/boot.c Fri Jul 13 02:02:16 2018 (r336236) @@ -87,6 +87,10 @@ readboot(int dosfs, struct bootblock *boot) pfatal("Invalid sector size: %u", boot->bpbBytesPerSec); return FSFATAL; } + if (boot->bpbFATs == 0) { + pfatal("Invalid number of FATs: %u", boot->bpbFATs); + return FSFATAL; + } if (!boot->bpbRootDirEnts) boot->flags |= FAT32; if (boot->flags & FAT32) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807130202.w6D22GJ4035338>