summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-09-24 21:11:47 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-09-24 21:11:47 +0000
commitbee183dd20204b0d3063dce9c37d529474460e3a (patch)
tree0f844632d5487502913c4d240c87e2cf9cfbb711 /bin
parentd5874c6c876d2feff011c4fbf8ce6c43c1679019 (diff)
realloc fix; ho ok
Diffstat (limited to 'bin')
-rw-r--r--bin/rmail/rmail.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c
index c8f5146f0a3..25e51311da0 100644
--- a/bin/rmail/rmail.c
+++ b/bin/rmail/rmail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rmail.c,v 1.17 2003/07/29 00:24:16 deraadt Exp $ */
+/* $OpenBSD: rmail.c,v 1.18 2003/09/24 21:11:46 deraadt Exp $ */
/* $NetBSD: rmail.c,v 1.8 1995/09/07 06:51:50 jtc Exp $ */
/*
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)rmail.c 8.3 (Berkeley) 5/15/95";
#else
-static char rcsid[] = "$OpenBSD: rmail.c,v 1.17 2003/07/29 00:24:16 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rmail.c,v 1.18 2003/09/24 21:11:46 deraadt Exp $";
#endif
#endif /* not lint */
@@ -203,10 +203,14 @@ main(int argc, char *argv[])
err(EX_TEMPFAIL, NULL);
}
if (fplen + len + 2 > fptlen) {
- fptlen += MAX(fplen + len + 2, 256);
- if ((from_path =
- realloc(from_path, fptlen)) == NULL)
+ size_t newfptlen = fptlen +
+ MAX(fplen + len + 2, 256);
+ char *np;
+
+ if ((np = realloc(from_path, newfptlen)) == NULL)
err(EX_TEMPFAIL, NULL);
+ from_path = np;
+ fptlen = newfptlen;
}
memmove(from_path + fplen, p, len);
fplen += len;