summaryrefslogtreecommitdiff
path: root/rr.c
diff options
context:
space:
mode:
authorWillem Toorop <willem@nlnetlabs.nl>2016-10-17 23:23:50 +0200
committerWillem Toorop <willem@nlnetlabs.nl>2016-10-17 23:23:50 +0200
commit2f055e06c4c395e617f2f8261d7882f2aec2a776 (patch)
tree74106e4b739c09e72c3136d7c65290fd96787459 /rr.c
parent180eb1ba7d072f3e4b2379f6b9b0f692a713bf95 (diff)
downloadldns-2f055e06c4c395e617f2f8261d7882f2aec2a776.tar.gz
bugfix #760: Detect superfluous text in presentation format
Thanks Xiali Yan
Diffstat (limited to 'rr.c')
-rw-r--r--rr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/rr.c b/rr.c
index 237ceae0..e8e51f60 100644
--- a/rr.c
+++ b/rr.c
@@ -600,9 +600,14 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str,
} /* for (done = false, r_cnt = 0; !done && r_cnt < r_max; r_cnt++) */
LDNS_FREE(rd);
LDNS_FREE(xtok);
- ldns_buffer_free(rd_buf);
ldns_buffer_free(rr_buf);
LDNS_FREE(rdata);
+ if (ldns_buffer_remaining(rd_buf) > 0) {
+ ldns_buffer_free(rd_buf);
+ ldns_rr_free(new);
+ return LDNS_STATUS_SYNTAX_SUPERFLUOUS_TEXT_ERR;
+ }
+ ldns_buffer_free(rd_buf);
if (!question && desc && !was_unknown_rr_format &&
ldns_rr_rd_count(new) < r_min) {