aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/librdns
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-23 14:10:01 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-23 14:10:01 +0100
commitc96b4fc946407b9e1701a0b2c9b67339165ab1f5 (patch)
tree46d4ac0d49ca8088b79dd2d24fdd600d1613bbee /contrib/librdns
parent2d107f5ab95de2f2e94aa0a7d4cdd2808e721758 (diff)
downloadrspamd-c96b4fc946407b9e1701a0b2c9b67339165ab1f5.tar.gz
rspamd-c96b4fc946407b9e1701a0b2c9b67339165ab1f5.zip
[Minor] Rdns: One more sanity check added
Diffstat (limited to 'contrib/librdns')
-rw-r--r--contrib/librdns/parse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/librdns/parse.c b/contrib/librdns/parse.c
index 559d430a0..18bb6a694 100644
--- a/contrib/librdns/parse.c
+++ b/contrib/librdns/parse.c
@@ -370,6 +370,16 @@ rdns_parse_rr (struct rdns_resolver *resolver,
*remain -= txtlen + 1;
}
else {
+
+ if (txtlen + copied + parts > datalen) {
+ /* Incorrect datalen reported ! */
+ rdns_err ("incorrect txtlen (%d) > datalen (%d) reported; domain %s",
+ (txtlen + copied + parts), datalen,
+ rep->requested_name);
+ return -1;
+ }
+
+ /* Reported equal to the actual data copied */
break;
}
}
@@ -425,7 +435,7 @@ rdns_parse_rr (struct rdns_resolver *resolver,
*remain -= datalen;
break;
default:
- rdns_debug ("unexpected RR type: %d; domain %s", type, rep->requested_name);
+ rdns_info ("unexpected RR type: %d; domain %s", type, rep->requested_name);
p += datalen;
*remain -= datalen;
break;