From owner-svn-src-head@freebsd.org Fri Jul 13 02:02:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19340104391A; Fri, 13 Jul 2018 02:02:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C216B8E2BD; Fri, 13 Jul 2018 02:02:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A49E11B18; Fri, 13 Jul 2018 02:02:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6D22GOM035339; Fri, 13 Jul 2018 02:02:16 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6D22GJ4035338; Fri, 13 Jul 2018 02:02:16 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201807130202.w6D22GJ4035338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 13 Jul 2018 02:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336236 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 336236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2018 02:02:17 -0000 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) {