summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2017-03-17 20:56:05 +0000
committerEric Faurot <eric@cvs.openbsd.org>2017-03-17 20:56:05 +0000
commit7023eb9db21f0d131a9e805f46849e41834f23d1 (patch)
treec110f4cfc7b3a952d4fb378408c7633eb1119b74 /usr.sbin/smtpd
parentf2aba623c9fd4a49adcd5c91ab22c260f64c53de (diff)
realloc() -> recallocarray().
use calloc() for initial allocation. prodded by deraadt@ ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/iobuf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/iobuf.c b/usr.sbin/smtpd/iobuf.c
index e8180cd136d..27c404a0b7a 100644
--- a/usr.sbin/smtpd/iobuf.c
+++ b/usr.sbin/smtpd/iobuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iobuf.c,v 1.9 2015/12/14 10:22:12 jung Exp $ */
+/* $OpenBSD: iobuf.c,v 1.10 2017/03/17 20:56:04 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -53,7 +53,7 @@ iobuf_init(struct iobuf *io, size_t size, size_t max)
if (size > max)
return (-1);
- if ((io->buf = malloc(size)) == NULL)
+ if ((io->buf = calloc(size, 1)) == NULL)
return (-1);
io->size = size;
@@ -110,7 +110,7 @@ iobuf_extend(struct iobuf *io, size_t n)
if (io->max - io->size < n)
return (-1);
- t = realloc(io->buf, io->size + n);
+ t = recallocarray(io->buf, io->size, io->size + n, 1);
if (t == NULL)
return (-1);