Author: delphij
Date: Thu Nov 30 08:28:17 2017
New Revision: 326391
URL: https://svnweb.freebsd.org/changeset/base/326391

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

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c        Thu Nov 30 08:28:04 2017        
(r326390)
+++ head/sbin/fsck_msdosfs/dir.c        Thu Nov 30 08:28:17 2017        
(r326391)
@@ -621,7 +621,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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to