Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/dist/bind/lib/resolv Pull up revision 1.5 (requested by...
details: https://anonhg.NetBSD.org/src/rev/0a7c15e3b2f6
branches: netbsd-1-6
changeset: 528236:0a7c15e3b2f6
user: lukem <lukem%NetBSD.org@localhost>
date: Fri Jun 28 11:57:37 2002 +0000
description:
Pull up revision 1.5 (requested by itojun in ticket #387):
Update to BIND 8.3.3. Fixes buffer overrun in resolver code.
diffstat:
dist/bind/lib/resolv/res_debug.c | 221 ++++++++++++++++++++++++++------------
1 files changed, 152 insertions(+), 69 deletions(-)
diffs (truncated from 416 to 300 lines):
diff -r 324bc9387ef0 -r 0a7c15e3b2f6 dist/bind/lib/resolv/res_debug.c
--- a/dist/bind/lib/resolv/res_debug.c Fri Jun 28 11:57:27 2002 +0000
+++ b/dist/bind/lib/resolv/res_debug.c Fri Jun 28 11:57:37 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: res_debug.c,v 1.4 2001/05/17 23:00:20 itojun Exp $ */
+/* $NetBSD: res_debug.c,v 1.4.2.1 2002/06/28 11:57:37 lukem Exp $ */
/*
* Copyright (c) 1985
@@ -97,7 +97,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "Id: res_debug.c,v 8.38 2001/02/13 23:12:56 marka Exp";
+static const char rcsid[] = "Id: res_debug.c,v 8.46 2002/05/21 01:57:45 marka Exp";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
@@ -189,7 +189,12 @@
ns_rr_name(rr),
p_type(ns_rr_type(rr)),
p_class(ns_rr_class(rr)));
- else {
+ else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) {
+ u_int32_t ttl = ns_rr_ttl(rr);
+ fprintf(file,
+ "; EDNS: version: %u, udp=%u, flags=%04x\n",
+ (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff);
+ } else {
n = ns_sprintrr(handle, &rr, NULL, NULL,
buf, buflen);
if (n < 0) {
@@ -358,32 +363,32 @@
* C_ANY, but you can't have any records of that class in the database.)
*/
const struct res_sym __p_class_syms[] = {
- {C_IN, "IN"},
- {C_CHAOS, "CHAOS"},
- {C_HS, "HS"},
- {C_HS, "HESIOD"},
- {C_ANY, "ANY"},
- {C_NONE, "NONE"},
- {C_IN, (char *)0}
+ {C_IN, "IN", (char *)0},
+ {C_CHAOS, "CHAOS", (char *)0},
+ {C_HS, "HS", (char *)0},
+ {C_HS, "HESIOD", (char *)0},
+ {C_ANY, "ANY", (char *)0},
+ {C_NONE, "NONE", (char *)0},
+ {C_IN, (char *)0, (char *)0}
};
/*
* Names of message sections.
*/
const struct res_sym __p_default_section_syms[] = {
- {ns_s_qd, "QUERY"},
- {ns_s_an, "ANSWER"},
- {ns_s_ns, "AUTHORITY"},
- {ns_s_ar, "ADDITIONAL"},
- {0, (char *)0}
+ {ns_s_qd, "QUERY", (char *)0},
+ {ns_s_an, "ANSWER", (char *)0},
+ {ns_s_ns, "AUTHORITY", (char *)0},
+ {ns_s_ar, "ADDITIONAL", (char *)0},
+ {0, (char *)0, (char *)0}
};
const struct res_sym __p_update_section_syms[] = {
- {S_ZONE, "ZONE"},
- {S_PREREQ, "PREREQUISITE"},
- {S_UPDATE, "UPDATE"},
- {S_ADDT, "ADDITIONAL"},
- {0, (char *)0}
+ {S_ZONE, "ZONE", (char *)0},
+ {S_PREREQ, "PREREQUISITE", (char *)0},
+ {S_UPDATE, "UPDATE", (char *)0},
+ {S_ADDT, "ADDITIONAL", (char *)0},
+ {0, (char *)0, (char *)0}
};
const struct res_sym __p_key_syms[] = {
@@ -538,7 +543,17 @@
*/
const char *
p_type(int type) {
- return (sym_ntos(__p_type_syms, type, (int *)0));
+ int success;
+ const char *result;
+ static char typebuf[20];
+
+ result = sym_ntos(__p_type_syms, type, &success);
+ if (success)
+ return (result);
+ if (type < 0 || type > 0xfff)
+ return ("BADTYPE");
+ sprintf(typebuf, "TYPE%d", type);
+ return (typebuf);
}
/*
@@ -564,7 +579,17 @@
*/
const char *
p_class(int class) {
- return (sym_ntos(__p_class_syms, class, (int *)0));
+ int success;
+ const char *result;
+ static char classbuf[20];
+
+ result = sym_ntos(__p_class_syms, class, &success);
+ if (success)
+ return (result);
+ if (class < 0 || class > 0xfff)
+ return ("BADCLASS");
+ sprintf(classbuf, "CLASS%d", class);
+ return (classbuf);
}
/*
@@ -587,6 +612,24 @@
case RES_DNSRCH: return "dnsrch";
case RES_INSECURE1: return "insecure1";
case RES_INSECURE2: return "insecure2";
+ case RES_NOALIASES: return "noaliases";
+ case RES_USE_INET6: return "inet6";
+#ifdef RES_USE_EDNS0 /* KAME extension */
+ case RES_USE_EDNS0: return "edns0";
+#endif
+#ifdef RES_USE_A6
+ case RES_USE_A6: return "a6";
+#endif
+#ifdef RES_USE_DNAME
+ case RES_USE_DNAME: return "dname";
+#endif
+#ifdef RES_USE_DNSSEC
+ case RES_USE_DNSSEC: return "dnssec";
+#endif
+#ifdef RES_NOTLDQUERY
+ case RES_NOTLDQUERY: return "no-tld-query";
+#endif
+
/* XXX nonreentrant */
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
@@ -642,25 +685,23 @@
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
static u_int8_t
-precsize_aton(strptr)
- char **strptr;
-{
+precsize_aton(const char **strptr) {
unsigned int mval = 0, cmval = 0;
u_int8_t retval = 0;
- char *cp;
+ const char *cp;
int exponent;
int mantissa;
cp = *strptr;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
mval = mval * 10 + (*cp++ - '0');
if (*cp == '.') { /* centimeters */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval = (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval += (*cp++ - '0');
}
}
@@ -684,54 +725,51 @@
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
static u_int32_t
-latlon2ul(latlonstrptr,which)
- char **latlonstrptr;
- int *which;
-{
- char *cp;
+latlon2ul(const char **latlonstrptr, int *which) {
+ const char *cp;
u_int32_t retval;
int deg = 0, min = 0, secs = 0, secsfrac = 0;
cp = *latlonstrptr;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
deg = deg * 10 + (*cp++ - '0');
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
- if (!(isdigit(*cp)))
+ if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
min = min * 10 + (*cp++ - '0');
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
- if (!(isdigit(*cp)))
+ if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
secs = secs * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal seconds */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac = (*cp++ - '0') * 100;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0');
}
}
}
}
- while (!isspace(*cp)) /* if any trailing garbage */
+ while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
fndhemi:
@@ -769,10 +807,10 @@
cp++; /* skip the hemisphere */
- while (!isspace(*cp)) /* if any trailing garbage */
+ while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
- while (isspace(*cp)) /* move to next field */
+ while (isspace((unsigned char)*cp)) /* move to next field */
cp++;
*latlonstrptr = cp;
@@ -830,14 +868,14 @@
if (*cp == '+')
cp++;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
altmeters = altmeters * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal meters */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
altfrac = (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
altfrac += (*cp++ - '0');
}
}
@@ -845,10 +883,10 @@
alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
- while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
- while (isspace(*cp) && (cp < maxcp))
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
@@ -856,10 +894,10 @@
siz = precsize_aton(&cp);
- while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
- while (isspace(*cp) && (cp < maxcp))
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
Home |
Main Index |
Thread Index |
Old Index