summaryrefslogtreecommitdiff
path: root/lib/libutil/imsg-buffer.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-03-17 14:51:27 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-03-17 14:51:27 +0000
commitf1f4b94d7f5354c994ee9f50e10da749e52dd831 (patch)
tree5fa7dc8136e506adea8b06953c7eceea5b90f388 /lib/libutil/imsg-buffer.c
parentf02fc827600b129702e796d477d4cf48bb3629aa (diff)
Grow buffers using recallocarray, to avoid the potential dribble that
the standard realloc*() functions can leave behind. imsg buffers are sometimes used in protocol stacks which require some secrecy, and layering violations would be needed to resolve this issue otherwise. Discussed with many.
Diffstat (limited to 'lib/libutil/imsg-buffer.c')
-rw-r--r--lib/libutil/imsg-buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libutil/imsg-buffer.c b/lib/libutil/imsg-buffer.c
index 58c6655fec8..f12d4ef58c4 100644
--- a/lib/libutil/imsg-buffer.c
+++ b/lib/libutil/imsg-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg-buffer.c,v 1.8 2015/12/29 18:05:01 benno Exp $ */
+/* $OpenBSD: imsg-buffer.c,v 1.9 2017/03/17 14:51:26 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -78,7 +78,7 @@ ibuf_realloc(struct ibuf *buf, size_t len)
return (-1);
}
- b = realloc(buf->buf, buf->wpos + len);
+ b = recallocarray(buf->buf, buf->size, buf->wpos + len, 1);
if (b == NULL)
return (-1);
buf->buf = b;