summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getnetbydns.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2002-09-15 16:51:09 +0000
committernectar <nectar@FreeBSD.org>2002-09-15 16:51:09 +0000
commitb44001f0c35c71357de671925af59585fe44a345 (patch)
treeb148cf252878680c37bb7a53070e4d454eed0300 /lib/libc/net/getnetbydns.c
parent486bc9dab8aab95468a5910f1ad064ed33582577 (diff)
downloadFreeBSD-src-b44001f0c35c71357de671925af59585fe44a345.zip
FreeBSD-src-b44001f0c35c71357de671925af59585fe44a345.tar.gz
Check for truncation in calls to res_send/res_query/res_search.
Fail when it is detected.
Diffstat (limited to 'lib/libc/net/getnetbydns.c')
-rw-r--r--lib/libc/net/getnetbydns.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c
index 369bf2b..fd771f2 100644
--- a/lib/libc/net/getnetbydns.c
+++ b/lib/libc/net/getnetbydns.c
@@ -263,7 +263,13 @@ _dns_getnetbyaddr(void *rval, void *cb_data, va_list ap)
if (anslen < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
- printf("res_query failed\n");
+ printf("res_search failed\n");
+#endif
+ return NS_UNAVAIL;
+ } else if (anslen > sizeof(buf)) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf("res_search static buffer too small");
#endif
return NS_UNAVAIL;
}
@@ -303,7 +309,13 @@ _dns_getnetbyname(void *rval, void *cb_data, va_list ap)
if (anslen < 0) {
#ifdef DEBUG
if (_res.options & RES_DEBUG)
- printf("res_query failed\n");
+ printf("res_search failed\n");
+#endif
+ return NS_UNAVAIL;
+ } else if (anslen > sizeof(buf)) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf("res_search static buffer too small");
#endif
return NS_UNAVAIL;
}
OpenPOWER on IntegriCloud