svn commit: r348967 - head/sbin/fsck_msdosfs

Xin LI delphij at FreeBSD.org
Tue Jun 11 22:21:30 UTC 2019


Author: delphij
Date: Tue Jun 11 22:21:29 2019
New Revision: 348967
URL: https://svnweb.freebsd.org/changeset/base/348967

Log:
  Avoid out of boundary access when checking invalid long filenames.
  
  Obtained from:	OpenBSD (dir.c,v 1.25)
  MFC after:	3 days

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c	Tue Jun 11 22:07:39 2019	(r348966)
+++ head/sbin/fsck_msdosfs/dir.c	Tue Jun 11 22:21:29 2019	(r348967)
@@ -629,6 +629,15 @@ readDosDirSection(int f, struct bootblock *boot, struc
 					vallfn = NULL;
 				}
 				lidx = *p & LRNOMASK;
+				if (lidx == 0) {
+					pwarn("invalid long name\n");
+					if (!invlfn) {
+						invlfn = vallfn;
+						invcl = valcl;
+					}
+					vallfn = NULL;
+					continue;
+				}
 				t = longName + --lidx * 13;
 				for (k = 1; k < 11 && t < longName +
 				    sizeof(longName); k += 2) {


More information about the svn-src-head mailing list