summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostbydns.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2000-02-16 04:39:00 +0000
committerfenner <fenner@FreeBSD.org>2000-02-16 04:39:00 +0000
commit2471367d59092bab28bfec047f4d337ddaf0a516 (patch)
treee3cf4bc78c6b8d9a8f1ef7305dc1c2d78577c8ff /lib/libc/net/gethostbydns.c
parent324e4fb55b741b953a4a79dd2ce1238295587ed4 (diff)
downloadFreeBSD-src-2471367d59092bab28bfec047f4d337ddaf0a516.zip
FreeBSD-src-2471367d59092bab28bfec047f4d337ddaf0a516.tar.gz
Fix coredump in gethostbyaddr() when the returned answer is too large to
fit in the static buffer. This fix causes it to look like there is no data available, which is also wrong but is better than dumping core. PR: bin/10344 Reviewed by: billf Approved by: jkh
Diffstat (limited to 'lib/libc/net/gethostbydns.c')
-rw-r--r--lib/libc/net/gethostbydns.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c
index a77b65d..a5a3e7b 100644
--- a/lib/libc/net/gethostbydns.c
+++ b/lib/libc/net/gethostbydns.c
@@ -664,6 +664,10 @@ _gethostbydnsaddr(addr, len, af)
dprintf("res_query failed (%d)\n", n);
return (NULL);
}
+ if (n > sizeof buf.buf) {
+ dprintf("static buffer is too small (%d)\n", n);
+ return (NULL);
+ }
if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR)))
return (NULL); /* h_errno was set by gethostanswer() */
#ifdef SUNSECURITY
OpenPOWER on IntegriCloud