svn commit: r326843 - stable/10/sbin/fsck_msdosfs

Xin LI delphij at FreeBSD.org
Thu Dec 14 07:55:12 UTC 2017


Author: delphij
Date: Thu Dec 14 07:55:11 2017
New Revision: 326843
URL: https://svnweb.freebsd.org/changeset/base/326843

Log:
  MFC r326391: Prevent OOB access on corrupted msdos directories.
  
  Submitted by:	Veo Zhang <veo live com>

Modified:
  stable/10/sbin/fsck_msdosfs/dir.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/fsck_msdosfs/dir.c
==============================================================================
--- stable/10/sbin/fsck_msdosfs/dir.c	Thu Dec 14 07:52:38 2017	(r326842)
+++ stable/10/sbin/fsck_msdosfs/dir.c	Thu Dec 14 07:55:11 2017	(r326843)
@@ -619,7 +619,7 @@ readDosDirSection(int f, struct bootblock *boot, struc
 			dirent.name[8] = '\0';
 			for (k = 7; k >= 0 && dirent.name[k] == ' '; k--)
 				dirent.name[k] = '\0';
-			if (dirent.name[k] != '\0')
+			if (k < 0 || dirent.name[k] != '\0')
 				k++;
 			if (dirent.name[0] == SLOT_E5)
 				dirent.name[0] = 0xe5;


More information about the svn-src-stable-10 mailing list