summaryrefslogtreecommitdiff
path: root/lib/libc/asr
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-03-15 15:54:42 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-03-15 15:54:42 +0000
commit72618eab024376d723abd851958dcbda421a2135 (patch)
treed6173e011c761290b6ab04d4b34879b8b115fb83 /lib/libc/asr
parent2205cc0e26d80db1f2f5874458d42e5e702e761b (diff)
use recallocarray to resize buffer - ensures that detritus from previous
lookups isn't left lying around the address space. ok eric
Diffstat (limited to 'lib/libc/asr')
-rw-r--r--lib/libc/asr/res_send_async.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/asr/res_send_async.c b/lib/libc/asr/res_send_async.c
index 3c3dd722e2b..d0b4cb0e060 100644
--- a/lib/libc/asr/res_send_async.c
+++ b/lib/libc/asr/res_send_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send_async.c,v 1.35 2017/03/14 15:15:19 deraadt Exp $ */
+/* $OpenBSD: res_send_async.c,v 1.36 2017/03/15 15:54:41 deraadt Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -648,7 +648,7 @@ ensure_ibuf(struct asr_query *as, size_t n)
if (as->as.dns.ibufsize >= n)
return (0);
- t = realloc(as->as.dns.ibuf, n);
+ t = recallocarray(as->as.dns.ibuf, as->as.dns.ibufsize, n, 1);
if (t == NULL)
return (-1); /* errno set */
as->as.dns.ibuf = t;