diff options
author | 2017-04-12 15:23:08 +0000 | |
---|---|---|
committer | 2017-04-12 15:23:08 +0000 | |
commit | 46e7f36feb8ac85925dcb01367a405d44c2fe952 (patch) | |
tree | efd2f0d583ba067b8699dd4781fb9154a417d83b | |
parent | isblank() is ANSI C since C99, no need to provide a replacement. (diff) | |
download | wireguard-openbsd-46e7f36feb8ac85925dcb01367a405d44c2fe952.tar.xz wireguard-openbsd-46e7f36feb8ac85925dcb01367a405d44c2fe952.zip |
Prevent inosused from wrapping when soft updates is enabled while
scanning the used inode map. The code as written assumes inosused
is signed but this is no longer the case. OK deraadt@
-rw-r--r-- | sbin/fsck_ffs/pass1.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c index 02bb8ad32a5..61d5431ecb8 100644 --- a/sbin/fsck_ffs/pass1.c +++ b/sbin/fsck_ffs/pass1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pass1.c,v 1.44 2017/04/10 08:19:12 fcambus Exp $ */ +/* $OpenBSD: pass1.c,v 1.45 2017/04/12 15:23:08 millert Exp $ */ /* $NetBSD: pass1.c,v 1.16 1996/09/27 22:45:15 christos Exp $ */ /* @@ -116,9 +116,14 @@ pass1(void) */ if (preen && usedsoftdep) { cp = &cg_inosused(&cgrp)[(inosused - 1) / CHAR_BIT]; - for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) { - if (*cp == 0) + for ( ; inosused != 0; cp--) { + if (*cp == 0) { + if (inosused > CHAR_BIT) + inosused -= CHAR_BIT; + else + inosused = 0; continue; + } for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) { if (*cp & i) break; |