Commit c8d28d89 authored by Jan Včelák's avatar Jan Včelák 🚀

TSIG: check RDATA size before seeking for fields

parent 81fca848
......@@ -59,11 +59,13 @@ typedef enum tsig_off_t {
static uint8_t* rdata_seek(const knot_rrset_t *rr, tsig_off_t id, size_t nb)
{
const knot_rdata_t *rr_data = knot_rdataset_at(&rr->rrs, 0);
uint8_t *rd = knot_rdata_data(rr_data);
if (rd == NULL) {
if (!rr_data || knot_rdata_rdlen(rr_data) == 0) {
return NULL;
}
uint8_t *rd = knot_rdata_data(rr_data);
assert(rd);
/* TSIG RR names should be already sanitized on parse. */
int alg_len = knot_dname_size(rd);
uint16_t lim = knot_rdata_rdlen(rr_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment