summaryrefslogtreecommitdiff
path: root/rr.c
diff options
context:
space:
mode:
authorMatthijs Mekking <matje@NLnetLabs.nl>2011-04-20 11:21:29 +0200
committerMatthijs Mekking <matje@NLnetLabs.nl>2011-04-20 11:21:29 +0200
commit932b7f68e726f732d9fa431c01470de236e844d2 (patch)
treecf84fdac1c41b61d48cdaeed32f0c60e7da04818 /rr.c
parentc6202d3b3e9eba4d158289e4ceadb36bebeea74b (diff)
downloadldns-932b7f68e726f732d9fa431c01470de236e844d2.tar.gz
do not loop, but syntax error on a malformed unknown RR
Diffstat (limited to 'rr.c')
-rw-r--r--rr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/rr.c b/rr.c
index 9d47aa65..5be57851 100644
--- a/rr.c
+++ b/rr.c
@@ -431,6 +431,17 @@ ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str,
cur_hex_data_size = 0;
while(cur_hex_data_size < 2 * hex_data_size) {
c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN);
+ if (c == -1) {
+ LDNS_FREE(hex_data_str);
+ LDNS_FREE(rd);
+ LDNS_FREE(b64);
+ ldns_buffer_free(rd_buf);
+ ldns_buffer_free(rr_buf);
+ LDNS_FREE(rdata);
+ ldns_rr_free(new);
+ return LDNS_STATUS_SYNTAX_RDATA_ERR;
+ }
+ rd_strlen = strlen(rd);
rd_strlen = strlen(rd);
strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen);
cur_hex_data_size += rd_strlen;