Module Name: src
Committed By: hannken
Date: Mon Jun 7 14:07:32 UTC 2021
Modified Files:
src/sbin/dump: tape.c
Log Message:
Bitmaps (TS_BITS and TS_CLRI) dont use the "c_addr" array as they
cannot have holes. As bitmaps are written without TS_ADDR records
"c_count" may be larger than the "c_addr" size resulting in a
segmentation violation reading "c_addr" beyond its end.
Compute "blks" for TS_INODE and TS_ADDR only -- its used for multi
volume dumps and the bitmaps must both be on the first volume.
To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sbin/dump/tape.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/dump/tape.c
diff -u src/sbin/dump/tape.c:1.55 src/sbin/dump/tape.c:1.56
--- src/sbin/dump/tape.c:1.55 Fri Mar 1 16:42:11 2019
+++ src/sbin/dump/tape.c Mon Jun 7 14:07:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tape.c,v 1.55 2019/03/01 16:42:11 christos Exp $ */
+/* $NetBSD: tape.c,v 1.56 2021/06/07 14:07:32 hannken Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tape.c 8.4 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: tape.c,v 1.55 2019/03/01 16:42:11 christos Exp $");
+__RCSID("$NetBSD: tape.c,v 1.56 2021/06/07 14:07:32 hannken Exp $");
#endif
#endif /* not lint */
@@ -328,7 +328,8 @@ flushtape(void)
}
blks = 0;
- if (iswap32(spcl.c_type) != TS_END) {
+ if (iswap32(spcl.c_type) == TS_INODE ||
+ iswap32(spcl.c_type) == TS_ADDR) {
for (i = 0; i < iswap32(spcl.c_count); i++)
if (spcl.c_addr[i] != 0)
blks++;