diff options
author | fenner <fenner@FreeBSD.org> | 2000-02-16 04:39:00 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2000-02-16 04:39:00 +0000 |
commit | 2471367d59092bab28bfec047f4d337ddaf0a516 (patch) | |
tree | e3cf4bc78c6b8d9a8f1ef7305dc1c2d78577c8ff /lib | |
parent | 324e4fb55b741b953a4a79dd2ce1238295587ed4 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | lib/libc/net/gethostbydns.c | 4 |
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 |