summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/res_comp.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-06-27 08:22:03 +0000
committerpeter <peter@FreeBSD.org>1997-06-27 08:22:03 +0000
commit63d61ea6e9374a89adcb36c3f5c3b759b9a82c41 (patch)
tree42dba341377c853de43567a145b2a902b2039b15 /lib/libc/net/res_comp.c
parent20250d8619bb0419032ebda7ca41de01e60bea7f (diff)
downloadFreeBSD-src-63d61ea6e9374a89adcb36c3f5c3b759b9a82c41.zip
FreeBSD-src-63d61ea6e9374a89adcb36c3f5c3b759b9a82c41.tar.gz
Merge in bind-4.9.6 resolver changes. Note that they resolve the
overflow problem differently.
Diffstat (limited to 'lib/libc/net/res_comp.c')
-rw-r--r--lib/libc/net/res_comp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c
index 14a4ba8..86fd4ae 100644
--- a/lib/libc/net/res_comp.c
+++ b/lib/libc/net/res_comp.c
@@ -55,8 +55,8 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
-static char orig_rcsid[] = "From: Id: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp";
-static char rcsid[] = "$Id: res_comp.c,v 1.10 1997/02/22 15:00:29 peter Exp $";
+static char orig_rcsid[] = "From: Id: res_comp.c,v 8.12 1997/06/01 20:34:37 vixie Exp";
+static char rcsid[] = "$Id: res_comp.c,v 1.11 1997/06/13 19:21:54 ache Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -91,12 +91,10 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
register char *dn;
register int n, c;
char *eom;
- int len = -1, checked = 0;
+ int len = -1, checked = 0, octets = 0;
dn = exp_dn;
cp = comp_dn;
- if (length > MAXHOSTNAMELEN-1)
- length = MAXHOSTNAMELEN-1;
eom = exp_dn + length;
/*
* fetch next label in domain name
@@ -107,6 +105,9 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
*/
switch (n & INDIR_MASK) {
case 0:
+ octets += (n + 1);
+ if (octets > MAXCDNAME)
+ return (-1);
if (dn != exp_dn) {
if (dn >= eom)
return (-1);
@@ -178,6 +179,8 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
dn = (u_char *)exp_dn;
cp = comp_dn;
+ if (length > MAXCDNAME)
+ length = MAXCDNAME;
eob = cp + length;
lpp = cpp = NULL;
if (dnptrs != NULL) {
OpenPOWER on IntegriCloud