Allow remaining data RDF to be zero size

Usefull for NSECs on empty non terminals!
This commit is contained in:
Willem Toorop 2015-07-04 08:09:50 +02:00
parent 682f10b271
commit 99f0026961
2 changed files with 4 additions and 6 deletions

View File

@ -701,10 +701,8 @@ static int bitmap_has_type(priv_getdns_rdf_iter *bitmap, uint16_t rr_type)
uint8_t window = rr_type >> 8; uint8_t window = rr_type >> 8;
uint8_t subtype = rr_type & 0xFF; uint8_t subtype = rr_type & 0xFF;
if (!bitmap) if (!bitmap || (dptr = bitmap->pos) == (dend = bitmap->nxt))
return 0; return 0;
dptr = bitmap->pos;
dend = bitmap->nxt;
/* Type Bitmap = ( Window Block # | Bitmap Length | Bitmap ) + /* Type Bitmap = ( Window Block # | Bitmap Length | Bitmap ) +
* dptr[0] dptr[1] dptr[2:] * dptr[0] dptr[1] dptr[2:]

View File

@ -252,7 +252,7 @@ rdf_iter_find_nxt(priv_getdns_rdf_iter *i)
if (!(i->nxt = i->rdd_pos->special->rdf_end( if (!(i->nxt = i->rdd_pos->special->rdf_end(
i->pkt, i->pkt_end, i->pos))) i->pkt, i->pkt_end, i->pos)))
i->nxt = i->end; i->nxt = i->end;
} else } else /* RDF is for remaining data */
i->nxt = i->end; i->nxt = i->end;
if (i->nxt <= i->end) if (i->nxt <= i->end)
@ -304,8 +304,8 @@ priv_getdns_rdf_iter_next(priv_getdns_rdf_iter *i)
return NULL; return NULL;
i->rdd_pos += 1; i->rdd_pos += 1;
if ((i->pos = i->nxt) >= i->end) if ((i->pos = i->nxt) > i->end)
goto done; /* Out of rdata */ goto done; /* Overflow */
if (i->rdd_pos >= i->rdd_end && !(i->rdd_pos = i->rdd_repeat)) if (i->rdd_pos >= i->rdd_end && !(i->rdd_pos = i->rdd_repeat))
goto done; /* Remaining rdata, but out of definitions! */ goto done; /* Remaining rdata, but out of definitions! */
if (i->rdd_pos->type == GETDNS_RDF_REPEAT) if (i->rdd_pos->type == GETDNS_RDF_REPEAT)