summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2020-10-01 07:58:55 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2020-10-01 07:58:55 +0000
commit3fa13abd0ce9ce676a0849e8383e829fb0355c67 (patch)
treec1bcd203559e8483bce924f59fe71aff8717a24b /sbin
parente75c1c720c4d43670683fcf9fa0c7095d246010e (diff)
Only count the proper node types. Avoid out of-bound access for large
filesystems. From FreeBSD. ok millert@
Diffstat (limited to 'sbin')
-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++;