summaryrefslogtreecommitdiff
path: root/sbin/dump
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2018-04-26 17:40:49 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2018-04-26 17:40:49 +0000
commit6402426ed564bb7dc412d140a261f11d72f9218f (patch)
treea95145649100e3334f960a133b46b674a48efba6 /sbin/dump
parent1da30736cca6583602637a0c845770eefb287110 (diff)
Cast a multiplicand to ino_t to avoid overflow in 32*32=64 calculations
ok pirofti@ krw@
Diffstat (limited to 'sbin/dump')
-rw-r--r--sbin/dump/main.c4
-rw-r--r--sbin/dump/traverse.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index ef10ade5061..d5c85898819 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.59 2016/08/31 21:00:31 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.60 2018/04/26 17:40:48 guenther Exp $ */
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/*-
@@ -440,7 +440,7 @@ main(int argc, char *argv[])
sblock->fs_inodefmt >= FS_44INODEFMT)
spcl.c_flags |= DR_NEWINODEFMT;
#endif
- maxino = sblock->fs_ipg * sblock->fs_ncg;
+ maxino = (ino_t)sblock->fs_ipg * sblock->fs_ncg;
mapsize = roundup(howmany(maxino, NBBY), TP_BSIZE);
usedinomap = calloc((unsigned) mapsize, sizeof(char));
dumpdirmap = calloc((unsigned) mapsize, sizeof(char));
diff --git a/sbin/dump/traverse.c b/sbin/dump/traverse.c
index 5240d4b7ffd..6fc9eef4dd8 100644
--- a/sbin/dump/traverse.c
+++ b/sbin/dump/traverse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traverse.c,v 1.38 2015/01/20 18:22:20 deraadt Exp $ */
+/* $OpenBSD: traverse.c,v 1.39 2018/04/26 17:40:48 guenther Exp $ */
/* $NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $ */
/*-
@@ -156,7 +156,7 @@ fs_mapinodes(ino_t maxino, int64_t *tapesize, int *anydirskipped)
quit("fs_mapinodes: cannot allocate memory.\n");
for (cg = 0; cg < sblock->fs_ncg; cg++) {
- ino = cg * sblock->fs_ipg;
+ ino = cg * (ino_t)sblock->fs_ipg;
bread(fsbtodb(sblock, cgtod(sblock, cg)), (char *)cgp,
sblock->fs_cgsize);
if (sblock->fs_magic == FS_UFS2_MAGIC)