summaryrefslogtreecommitdiff
path: root/sbin/growfs/growfs.c
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-04-23 10:18:31 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-04-23 10:18:31 +0000
commita8d23536a47053c6796654fde2dc56415a49c7b9 (patch)
tree3aebd3ba0c95eb609aef1f00d1ae5762d0078e3b /sbin/growfs/growfs.c
parent36bca77f437c4b4c34d922559b78c02e05542848 (diff)
Remove 'cg_space' from 'struct cg'. Due to the alignment on 64-bit
architectures, CGSIZE() was returning something sligthly over one block. The 'new' fsck would round this value up to a fragment boundary, and end up trying to access memory beyond allocated space. From mickey@, okay pedro@, millert@ and otto@.
Diffstat (limited to 'sbin/growfs/growfs.c')
-rw-r--r--sbin/growfs/growfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index c82ffb1e70a..1d7ec8b243a 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.17 2007/03/19 13:27:47 pedro Exp $ */
+/* $OpenBSD: growfs.c,v 1.18 2007/04/23 10:18:30 pedro Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -46,7 +46,7 @@ static const char copyright[] =
Copyright (c) 1980, 1989, 1993 The Regents of the University of California.\n\
All rights reserved.\n";
-static const char rcsid[] = "$OpenBSD: growfs.c,v 1.17 2007/03/19 13:27:47 pedro Exp $";
+static const char rcsid[] = "$OpenBSD: growfs.c,v 1.18 2007/04/23 10:18:30 pedro Exp $";
#endif /* not lint */
/* ********************************************************** INCLUDES ***** */
@@ -384,7 +384,7 @@ initcg(int cylno, time_t utime, int fso, unsigned int Nflag)
acg.cg_ndblk = dmax - cbase;
if (sblock.fs_contigsumsize > 0)
acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
- acg.cg_btotoff = &acg.cg_space[0] - (u_char *)(&acg.cg_firstfield);
+ acg.cg_btotoff = sizeof(struct cg);
acg.cg_boff = acg.cg_btotoff + sblock.fs_cpg * sizeof(int32_t);
acg.cg_iusedoff = acg.cg_boff +
sblock.fs_cpg * sblock.fs_nrpos * sizeof(u_int16_t);