Skip to content

Commit

Permalink
Zero size only for non-repeating remaining data
Browse files Browse the repository at this point in the history
  • Loading branch information
wtoorop committed Jul 18, 2015
1 parent 16da0a0 commit 898fc15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/rr-dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 7 additions & 3 deletions src/rr-iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/util-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 898fc15

Please sign in to comment.