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

packet: limit RR count in packet parsing

parent 16404913
......@@ -821,6 +821,11 @@ int knot_pkt_parse_payload(knot_pkt_t *pkt, unsigned flags)
size_t rr_count = knot_wire_get_ancount(pkt->wire) +
knot_wire_get_nscount(pkt->wire) +
knot_wire_get_arcount(pkt->wire);
if (rr_count > pkt->size / KNOT_WIRE_RR_MIN_SIZE) {
return KNOT_EMALF;
}
int ret = pkt_rr_array_alloc(pkt, rr_count);
if (ret != KNOT_EOK) {
return ret;
......
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