summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-07-27 03:28:37 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-07-27 03:28:37 +0000
commita6e0d28439646d95ff9e9e377310c1d3716c3b90 (patch)
tree1c1d334fddff41719a265bc481f18eba710d8a48
parent8b0b4f1f86011e578e6a6d2faa41759f700c5311 (diff)
Pull in improper memory allocation from RCS:
> 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.
-rw-r--r--usr.bin/cvs/rcsnum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c
index 69fc51adbf1..d6f5d571a95 100644
--- a/usr.bin/cvs/rcsnum.c
+++ b/usr.bin/cvs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.38 2006/05/31 18:24:55 joris Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.39 2006/07/27 03:28:36 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -158,11 +158,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)));
}
/*