summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog2
-rw-r--r--error.c2
-rw-r--r--ldns/error.h3
-rw-r--r--rr.c7
4 files changed, 12 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index 6256aff0..a782e90f 100644
--- a/Changelog
+++ b/Changelog
@@ -81,6 +81,8 @@ TBD
Thanks Ngie Cooper
* bugfix #769: Add support for :: in an IPv6 address
Thanks Hajimu UMEMOTO
+ * bugfix #760: Detect superfluous text in presentation format
+ Thanks Xiali Yan
1.6.17 2014-01-10
* Fix ldns_dnssec_zone_new_frm_fp_l to allow the last parsed line of a
diff --git a/error.c b/error.c
index 82ea61a1..fde9c265 100644
--- a/error.c
+++ b/error.c
@@ -143,6 +143,8 @@ ldns_lookup_table ldns_error_str[] = {
{ LDNS_STATUS_INVALID_RDF_TYPE,
"The rdata field was not of the expected type" },
{ LDNS_STATUS_RDATA_OVERFLOW, "Rdata size overflow" },
+ { LDNS_STATUS_SYNTAX_SUPERFLUOUS_TEXT_ERR,
+ "Syntax error, superfluous text present" },
{ 0, NULL }
};
diff --git a/ldns/error.h b/ldns/error.h
index cc11958d..7d7983e8 100644
--- a/ldns/error.h
+++ b/ldns/error.h
@@ -126,7 +126,8 @@ enum ldns_enum_status {
LDNS_STATUS_INVALID_TAG,
LDNS_STATUS_TYPE_NOT_IN_BITMAP,
LDNS_STATUS_INVALID_RDF_TYPE,
- LDNS_STATUS_RDATA_OVERFLOW
+ LDNS_STATUS_RDATA_OVERFLOW,
+ LDNS_STATUS_SYNTAX_SUPERFLUOUS_TEXT_ERR
};
typedef enum ldns_enum_status ldns_status;
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) {