diff --git a/src/rr-dict.h b/src/rr-dict.h index 9228105e..98be61ba 100644 --- a/src/rr-dict.h +++ b/src/rr-dict.h @@ -54,7 +54,7 @@ typedef struct priv_getdns_rdf_special { #define GETDNS_RDF_INTEGER 0x010000 #define GETDNS_RDF_BINDATA 0x020000 -#define GETDNS_RDF_DNAME 0x060000 +#define GETDNS_RDF_DNAME 0x040000 #define GETDNS_RDF_COMPRESSED 0x080000 #define GETDNS_RDF_REPEAT 0x100000 diff --git a/src/rr-iter.c b/src/rr-iter.c index 7b980ef1..2e52759c 100644 --- a/src/rr-iter.c +++ b/src/rr-iter.c @@ -237,7 +237,7 @@ rdf_iter_find_nxt(priv_getdns_rdf_iter *i) i->nxt = i->pos + 1 < i->end ? i->pos + gldns_read_uint16(i->pos) + 2 : i->end; - else if ((i->rdd_pos->type & GETDNS_RDF_DNAME) == GETDNS_RDF_DNAME) + else if (i->rdd_pos->type & GETDNS_RDF_DNAME) for (pos = i->pos; pos < i->end; pos += *pos + 1) { if (!*pos) { @@ -257,8 +257,12 @@ rdf_iter_find_nxt(priv_getdns_rdf_iter *i) } else /* RDF is for remaining data */ i->nxt = i->end; - if ( i->nxt <= i->end - && (i->nxt > i->pos || !(i->rdd_pos->type & GETDNS_RDF_REPEAT))) + if ( i->nxt <= i->end && + + /* Empty rdata fields are only allowed in case of non-repeating + * remaining data. So only the GETDNS_RDF_BINDATA bit is set. + */ + (i->nxt > i->pos || (i->rdd_pos->type == GETDNS_RDF_BINDATA))) return i; done: i->pos = NULL; diff --git a/src/util-internal.c b/src/util-internal.c index bdb0ba8c..0cf964d5 100644 --- a/src/util-internal.c +++ b/src/util-internal.c @@ -271,8 +271,7 @@ priv_getdns_rr_iter2rr_dict(struct mem_funcs *mf, priv_getdns_rr_iter *i) default: goto rdata_error; } - } else if ((rdf->rdd_pos->type & GETDNS_RDF_DNAME) == - GETDNS_RDF_DNAME) { + } else if (rdf->rdd_pos->type & GETDNS_RDF_DNAME) { val_type = t_bindata; bindata.data = priv_getdns_rdf_if_or_as_decompressed(