summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/librdns/parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/librdns/parse.c b/contrib/librdns/parse.c
index 1a9c01838..e9fb85e98 100644
--- a/contrib/librdns/parse.c
+++ b/contrib/librdns/parse.c
@@ -351,10 +351,6 @@ rdns_parse_rr (struct rdns_resolver *resolver,
case DNS_T_TXT:
case DNS_T_SPF:
if (datalen <= *remain) {
- if (datalen > UINT16_MAX / 2) {
- rdns_info ("too large datalen; domain %s", rep->requested_name);
- return -1;
- }
elt->content.txt.data = malloc(datalen + 1);
if (elt->content.txt.data == NULL) {
rdns_err ("failed to allocate %d bytes for TXT record; domain %s",
@@ -417,20 +413,24 @@ rdns_parse_rr (struct rdns_resolver *resolver,
rdns_info ("stripped dns reply while reading TLSA record; domain %s", rep->requested_name);
return -1;
}
- if (datalen > UINT16_MAX / 2) {
+
+ if (datalen > *remain) {
rdns_info ("too large datalen; domain %s", rep->requested_name);
return -1;
}
+
GET8 (elt->content.tlsa.usage);
GET8 (elt->content.tlsa.selector);
GET8 (elt->content.tlsa.match_type);
datalen -= 3;
+
elt->content.tlsa.data = malloc (datalen);
if (elt->content.tlsa.data == NULL) {
rdns_err ("failed to allocate %d bytes for TLSA record; domain %s",
(int)datalen + 1, rep->requested_name);
return -1;
}
+
elt->content.tlsa.datalen = datalen;
memcpy (elt->content.tlsa.data, p, datalen);
p += datalen;