Skip to content

Commit 30f5627

Browse files
Pull up following revision(s) (requested by mlelstv in ticket #1964):
sbin/fsck_ffs/setup.c: revision 1.110 (patch) Don't truncate bitmap size to unsigned int, avoids crashes on filesystems with more than 2^32 blocks.
1 parent b923f51 commit 30f5627

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

sbin/fsck_ffs/setup.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: setup.c,v 1.102 2018/10/05 09:49:23 hannken Exp $ */
1+
/* $NetBSD: setup.c,v 1.102.2.1 2025/07/12 11:05:12 martin Exp $ */
22

33
/*
44
* Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
3434
#if 0
3535
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
3636
#else
37-
__RCSID("$NetBSD: setup.c,v 1.102 2018/10/05 09:49:23 hannken Exp $");
37+
__RCSID("$NetBSD: setup.c,v 1.102.2.1 2025/07/12 11:05:12 martin Exp $");
3838
#endif
3939
#endif /* not lint */
4040

@@ -86,7 +86,7 @@ int
8686
setup(const char *dev, const char *origdev)
8787
{
8888
long cg, size, asked, i, j;
89-
long bmapsize;
89+
size_t bmapsize;
9090
struct disk_geom geo;
9191
struct dkwedge_info dkw;
9292
off_t sizepb;
@@ -492,10 +492,10 @@ setup(const char *dev, const char *origdev)
492492
* allocate and initialize the necessary maps
493493
*/
494494
bmapsize = roundup(howmany(maxfsblock, NBBY), sizeof(int16_t));
495-
blockmap = calloc((unsigned)bmapsize, sizeof (char));
495+
blockmap = calloc(bmapsize, sizeof (char));
496496
if (blockmap == NULL) {
497-
pwarn("cannot alloc %u bytes for blockmap\n",
498-
(unsigned)bmapsize);
497+
pwarn("cannot alloc %zu bytes for blockmap\n",
498+
bmapsize);
499499
goto badsblabel;
500500
}
501501
inostathead = calloc((unsigned)(sblock->fs_ncg),

0 commit comments

Comments
 (0)