Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 22:21:29 +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: r348967 - head/sbin/fsck_msdosfs
Message-ID:  <201906112221.x5BMLTTG068335@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906112221.x5BMLTTG068335>