summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/rcsnum.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-07-27 03:17:11 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-07-27 03:17:11 +0000
commit8b0b4f1f86011e578e6a6d2faa41759f700c5311 (patch)
treee53532daecc513b165afd12c4c0fa8ca010df7b4 /usr.bin/rcs/rcsnum.c
parent44f6f525eb5e7ea6d3dcc5e6d3e4a5e72d02770a (diff)
Not were we allocating memory for a pointer array, it wasn't even for
the right variable! Fixes make regress with MALLOC_OPTIONS=PR. Found by and fix worked on with Joris. OK niallo@, tested by pedro@.
Diffstat (limited to 'usr.bin/rcs/rcsnum.c')
-rw-r--r--usr.bin/rcs/rcsnum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c
index 061ea2073d7..8ce3e3203b8 100644
--- a/usr.bin/rcs/rcsnum.c
+++ b/usr.bin/rcs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.2 2006/04/29 05:31:28 ray Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.3 2006/07/27 03:17:10 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -155,11 +155,12 @@ rcsnum_cpy(const RCSNUM *nsrc, RCSNUM *ndst, u_int depth)
if (depth != 0 && len > depth)
len = depth;
- tmp = xrealloc(ndst->rn_id, len, sizeof(len));
+ tmp = xrealloc(ndst->rn_id, len, sizeof(*(nsrc->rn_id)));
ndst->rn_id = tmp;
ndst->rn_len = len;
/* Overflow checked in xrealloc(). */
- (void)memcpy(ndst->rn_id, nsrc->rn_id, len * sizeof(len));
+ (void)memcpy(ndst->rn_id, nsrc->rn_id,
+ len * sizeof(*(nsrc->rn_id)));
}
/*