aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libc/net/getnetbydns.c
diff options
context:
space:
mode:
authorTrevor Johnson <trevor@FreeBSD.org>2002-07-10 06:57:44 +0000
committerTrevor Johnson <trevor@FreeBSD.org>2002-07-10 06:57:44 +0000
commit7f484866a20db7df608d7cfa9ab8e8bc089a5de8 (patch)
tree2858702d2f7d2e723a783d00f63ac2a2cae6f41a /lib/libc/net/getnetbydns.c
parent2a86dbea9c07a9c9b263025146cf294248a2a21a (diff)
downloadsrc-7f484866a20db7df608d7cfa9ab8e8bc089a5de8.tar.gz
src-7f484866a20db7df608d7cfa9ab8e8bc089a5de8.zip
MFC: fix buffer overflows described in FreeBSD-SA-02:28.resolv.
Reviewed by: imp
Notes
Notes: svn path=/releng/4.3/; revision=99716
Diffstat (limited to 'lib/libc/net/getnetbydns.c')
-rw-r--r--lib/libc/net/getnetbydns.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c
index 087aa5f6b9bf..e1a11d2e5d3a 100644
--- a/lib/libc/net/getnetbydns.c
+++ b/lib/libc/net/getnetbydns.c
@@ -173,7 +173,9 @@ static char *net_aliases[MAXALIASES], netbuf[PACKETSZ];
}
cp += n;
*ap++ = bp;
- bp += strlen(bp) + 1;
+ n = strlen(bp) + 1;
+ bp += n;
+ buflen -= n;
net_entry.n_addrtype =
(class == C_IN) ? AF_INET : AF_UNSPEC;
haveanswer++;