summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/rcsnum.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-28 02:13:45 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-28 02:13:45 +0000
commitdfbe3f4f54568b5eedfe5695987a22e774114f2a (patch)
treeff9dd12a8cf0838ea8838e117f422cf9e7bbd587 /usr.bin/cvs/rcsnum.c
parent44e7e454767c74777de3725352a5d79f6529fe60 (diff)
Today is Integer Overflow Prevention Day:
- Sync xmalloc.? with ssh versions. - Change all xrealloc() calls to new API. ``I really like this.'' niallo@
Diffstat (limited to 'usr.bin/cvs/rcsnum.c')
-rw-r--r--usr.bin/cvs/rcsnum.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/cvs/rcsnum.c b/usr.bin/cvs/rcsnum.c
index 86f8b1811a7..5431357e358 100644
--- a/usr.bin/cvs/rcsnum.c
+++ b/usr.bin/cvs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.28 2006/03/18 03:33:55 ray Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.29 2006/03/28 02:13:44 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -156,7 +156,7 @@ rcsnum_cpy(const RCSNUM *nsrc, RCSNUM *ndst, u_int depth)
len = depth;
sz = len * sizeof(u_int16_t);
- tmp = xrealloc(ndst->rn_id, sz);
+ tmp = xrealloc(ndst->rn_id, 1, sz);
ndst->rn_id = (u_int16_t *)tmp;
ndst->rn_len = len;
memcpy(ndst->rn_id, nsrc->rn_id, sz);
@@ -234,7 +234,7 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
nump->rn_len++;
tmp = xrealloc(nump->rn_id,
- (nump->rn_len + 1) * sizeof(u_int16_t));
+ nump->rn_len + 1, sizeof(u_int16_t));
nump->rn_id = (u_int16_t *)tmp;
nump->rn_id[nump->rn_len] = 0;
continue;
@@ -301,7 +301,7 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
/* We can't have a single-digit rcs number. */
if (nump->rn_len == 0) {
tmp = xrealloc(nump->rn_id,
- (nump->rn_len + 1) * sizeof(u_int16_t));
+ nump->rn_len + 1, sizeof(u_int16_t));
nump->rn_id = (u_int16_t *)tmp;
nump->rn_id[nump->rn_len + 1] = 0;
nump->rn_len++;
@@ -404,7 +404,7 @@ rcsnum_setsize(RCSNUM *num, u_int len)
{
void *tmp;
- tmp = xrealloc(num->rn_id, len * sizeof(u_int16_t));
+ tmp = xrealloc(num->rn_id, len, sizeof(u_int16_t));
num->rn_id = (u_int16_t *)tmp;
num->rn_len = len;
return (0);