summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2020-10-01 07:58:54 +0000
committerotto <otto@openbsd.org>2020-10-01 07:58:54 +0000
commita08df88e52297ef0dc9b987308d51f6d027bb446 (patch)
tree39d67cd93ed6f6b19381ced635d3cf5e7c65aeb6
parentmfokclock renamed to mfokrtc; (diff)
downloadwireguard-openbsd-a08df88e52297ef0dc9b987308d51f6d027bb446.tar.xz
wireguard-openbsd-a08df88e52297ef0dc9b987308d51f6d027bb446.zip
Only count the proper node types. Avoid out of-bound access for large
filesystems. From FreeBSD. ok millert@
-rw-r--r--sbin/dump/tape.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c
index c0cc1b6021d..68c1fe22435 100644
--- a/sbin/dump/tape.c
+++ b/sbin/dump/tape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tape.c,v 1.45 2019/06/28 13:32:43 deraadt Exp $ */
+/* $OpenBSD: tape.c,v 1.46 2020/10/01 07:58:54 otto Exp $ */
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/*-
@@ -330,7 +330,10 @@ flushtape(void)
}
blks = 0;
- if (spcl.c_type != TS_END) {
+ if (spcl.c_type != TS_END && spcl.c_type != TS_CLRI &&
+ spcl.c_type != TS_BITS) {
+ if (spcl.c_count > TP_NINDIR)
+ quit("c_count too large\n");
for (i = 0; i < spcl.c_count; i++)
if (spcl.c_addr[i] != 0)
blks++;