diff options
author | Warner Losh <imp@FreeBSD.org> | 2018-06-11 19:32:36 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2018-06-11 19:32:36 +0000 |
commit | 2d518c6518cdb256ff6f2c463e6b115d89c104c3 (patch) | |
tree | 2fbc4de66bfa01eaaad8b5f8d63db7f10f0cbcce /sbin/dump/tape.c | |
parent | 803fec5fdfcef4e09e6f86928974188ec59c3f62 (diff) | |
download | src-2d518c6518cdb256ff6f2c463e6b115d89c104c3.tar.gz src-2d518c6518cdb256ff6f2c463e6b115d89c104c3.zip |
Add asserts to prevent overflows of c_addr.
Add some asserts that prevents the overflows of c_addr. This can't
happen, absent bugs. However, certain large filesystems can cause
problems. These have been prevented by r334968, but a solution
is needed. These asserts will help assure that solution is correct.
PR: 228807
Reviewed by: db
Notes
Notes:
svn path=/head/; revision=334969
Diffstat (limited to 'sbin/dump/tape.c')
-rw-r--r-- | sbin/dump/tape.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c index 845a2660dad4..ed49f718fd0c 100644 --- a/sbin/dump/tape.c +++ b/sbin/dump/tape.c @@ -47,6 +47,7 @@ static const char rcsid[] = #include <protocols/dumprestore.h> +#include <assert.h> #include <errno.h> #include <fcntl.h> #include <limits.h> @@ -279,6 +280,7 @@ flushtape(void) blks = 0; if (spcl.c_type != TS_END) { + assert(spcl.c_count <= TP_NINDIR); for (i = 0; i < spcl.c_count; i++) if (spcl.c_addr[i] != 0) blks++; |