return (false);
}
- if (name->length > 255U || name->labels > 127U) {
+ if (name->length > DNS_NAME_MAXWIRE ||
+ name->labels > DNS_NAME_MAXLABELS)
+ {
return (false);
}
while (offset != length) {
count = *ndata;
- if (count > 63U) {
+ if (count > DNS_NAME_LABELLEN) {
return (false);
}
if (offsets != NULL && offsets[nlabels] != offset) {
ndata = name->ndata;
n = *ndata++;
- INSIST(n <= 63);
+ INSIST(n <= DNS_NAME_LABELLEN);
while (n--) {
ch = *ndata++;
if (!domainchar(ch)) {
*/
while (ndata < (name->ndata + name->length)) {
n = *ndata++;
- INSIST(n <= 63);
+ INSIST(n <= DNS_NAME_LABELLEN);
first = true;
while (n--) {
ch = *ndata++;
*/
while (ndata < (name->ndata + name->length)) {
n = *ndata++;
- INSIST(n <= 63);
+ INSIST(n <= DNS_NAME_LABELLEN);
first = true;
while (n--) {
ch = *ndata++;
*/
ndata = name->ndata;
count = *ndata++;
- INSIST(count <= 63);
+ INSIST(count <= DNS_NAME_LABELLEN);
ndata += count;
label = 1;
/*
*/
while (label + 1 < name->labels) {
count = *ndata++;
- INSIST(count <= 63);
+ INSIST(count <= DNS_NAME_LABELLEN);
if (count == 1 && *ndata == '*') {
return (true);
}
REQUIRE(VALID_NAME(name));
- ENSURE(name->labels <= 128);
+ ENSURE(name->labels <= DNS_NAME_MAXLABELS);
return (name->labels);
}
tused = 0;
ndata = isc_buffer_used(target);
nrem = isc_buffer_availablelength(target);
- if (nrem > 255) {
- nrem = 255;
+ if (nrem > DNS_NAME_MAXWIRE) {
+ nrem = DNS_NAME_MAXWIRE;
}
nused = 0;
labels = 0;
}
*label = count;
labels++;
- INSIST(labels <= 127);
+ INSIST(labels <= DNS_NAME_MAXLABELS);
offsets[labels] = nused;
if (tlen == 0) {
labels++;
} else if (c == '\\') {
state = ft_escape;
} else {
- if (count >= 63) {
+ if (count >= DNS_NAME_LABELLEN) {
return (DNS_R_LABELTOOLONG);
}
count++;
FALLTHROUGH;
case ft_escape:
if (!isdigit((unsigned char)c)) {
- if (count >= 63) {
+ if (count >= DNS_NAME_LABELLEN) {
return (DNS_R_LABELTOOLONG);
}
count++;
if (value > 255) {
return (DNS_R_BADESCAPE);
}
- if (count >= 63) {
+ if (count >= DNS_NAME_LABELLEN) {
return (DNS_R_LABELTOOLONG);
}
count++;
INSIST(label != NULL);
*label = count;
labels++;
- INSIST(labels <= 127);
+ INSIST(labels <= DNS_NAME_MAXLABELS);
offsets[labels] = nused;
}
if (origin != NULL) {
POST(nrem);
while (n1 > 0) {
n2 = *label++;
- INSIST(n2 <= 63); /* no bitstring support */
+ INSIST(n2 <= DNS_NAME_LABELLEN);
*ndata++ = n2;
n1 -= n2 + 1;
nused += n2 + 1;
}
labels++;
if (n1 > 0) {
- INSIST(labels <= 127);
+ INSIST(labels <= DNS_NAME_MAXLABELS);
offsets[labels] = nused;
}
}
saw_root = true;
break;
}
- if (count < 64) {
+ if (count <= DNS_NAME_LABELLEN) {
INSIST(nlen >= count);
while (count > 0) {
c = *ndata;
if (count == 0) {
break;
}
- if (count < 64) {
+ if (count <= DNS_NAME_LABELLEN) {
INSIST(nlen >= count);
while (count > 0) {
c = *ndata;
nlabels = 0;
absolute = false;
while (offset != length) {
- INSIST(nlabels < 128);
+ INSIST(nlabels <= DNS_NAME_MAXLABELS);
offsets[nlabels++] = offset;
count = *ndata;
- INSIST(count <= 63);
+ INSIST(count <= DNS_NAME_LABELLEN);
offset += count + 1;
ndata += count + 1;
INSIST(offset <= length);
*/
while (cursor < source_max) {
const uint8_t label_len = *cursor++;
- if (label_len < 64) {
+ if (label_len <= DNS_NAME_LABELLEN) {
/*
* Normal label: record its offset, and check bounds on
* the name length, which also ensures we don't overrun
#include <dns/keytable.h>
#include <dns/log.h>
#include <dns/message.h>
+#include <dns/name.h>
#include <dns/ncache.h>
#include <dns/nsec.h>
#include <dns/nsec3.h>
case ISC_R_FAILURE:
if ((fctx->options & DNS_FETCHOPT_QMIN_STRICT) == 0) {
/* Disable minimization in relaxed mode */
- fctx->qmin_labels = DNS_MAX_LABELS + 1;
+ fctx->qmin_labels = DNS_NAME_MAXLABELS + 1;
/*
* We store the result. If we succeed in the end
* we'll issue a warning that the server is
fctx->qmin_labels = nlabels;
}
} else if (fctx->qmin_labels > DNS_QMIN_MAXLABELS) {
- fctx->qmin_labels = DNS_MAX_LABELS + 1;
+ fctx->qmin_labels = DNS_NAME_MAXLABELS + 1;
}
if (fctx->qmin_labels < nlabels) {