Zero size only for non-repeating remaining data

This commit is contained in:
Willem Toorop 2015-07-18 18:04:11 +02:00
parent 16da0a01b5
commit 898fc15b6b
3 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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;

View File

@ -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(