aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/librdns/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/librdns/parse.c')
-rw-r--r--contrib/librdns/parse.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/librdns/parse.c b/contrib/librdns/parse.c
index 18bb6a694..1a9c01838 100644
--- a/contrib/librdns/parse.c
+++ b/contrib/librdns/parse.c
@@ -351,6 +351,10 @@ 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",
@@ -413,6 +417,10 @@ 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) {
+ 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);