Author: delphij
Date: Wed Apr  3 07:09:28 2019
New Revision: 345839
URL: https://svnweb.freebsd.org/changeset/base/345839

Log:
  Assert that q can't be NULL.  'empty' is always non-NULL when DIREMPTY
  is set earlier.
  
  MFC after:    1 month

Modified:
  head/sbin/fsck_msdosfs/dir.c

Modified: head/sbin/fsck_msdosfs/dir.c
==============================================================================
--- head/sbin/fsck_msdosfs/dir.c        Wed Apr  3 06:37:25 2019        
(r345838)
+++ head/sbin/fsck_msdosfs/dir.c        Wed Apr  3 07:09:28 2019        
(r345839)
@@ -35,6 +35,7 @@ static const char rcsid[] =
   "$FreeBSD$";
 #endif /* not lint */
 
+#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -520,7 +521,8 @@ readDosDirSection(int f, struct bootblock *boot, struc
                                                           empcl, empty - 
buffer,
                                                           cl, p - buffer, 1) 
== FSFATAL)
                                                        return FSFATAL;
-                                               q = empcl == cl ? empty : 
buffer;
+                                               q = ((empcl == cl) ? empty : 
buffer);
+                                               assert(q != NULL);
                                                for (; q < p; q += 32)
                                                        *q = SLOT_DELETED;
                                                mod |= THISMOD|FSDIRMOD;


_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to