diff options
author | Xin LI <delphij@FreeBSD.org> | 2019-04-03 07:09:28 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2019-04-03 07:09:28 +0000 |
commit | f806eb62a42eccc0b16a15b61390b2157d623821 (patch) | |
tree | b51687ee4e5f7a017d9e421e8e61f2fb762a5a4b /sbin/fsck_msdosfs/dir.c | |
parent | 62c7ea1f1d3693ec35e78ce16f0c0c260100b1ce (diff) |
Assert that q can't be NULL. 'empty' is always non-NULL when DIREMPTY
is set earlier.
MFC after: 1 month
Notes
Notes:
svn path=/head/; revision=345839
Diffstat (limited to 'sbin/fsck_msdosfs/dir.c')
-rw-r--r-- | sbin/fsck_msdosfs/dir.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/fsck_msdosfs/dir.c b/sbin/fsck_msdosfs/dir.c index 00bd33fc1860..0a2418eb9d12 100644 --- a/sbin/fsck_msdosfs/dir.c +++ b/sbin/fsck_msdosfs/dir.c @@ -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, struct fatEntry *fat, 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; |