Commit 110a4d99 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman

internet: fail if synthetized cname too long

Previously, the too-long-check for synthetized cname was only regarding
number of labels, but not overall length.
parent 0329eba9
......@@ -105,10 +105,11 @@ static int dname_cname_synth(const knot_rrset_t *dname_rr,
*/
static bool dname_cname_cannot_synth(const knot_rrset_t *rrset, const knot_dname_t *qname)
{
if (knot_dname_labels(qname, NULL)
- knot_dname_labels(rrset->owner, NULL)
+ knot_dname_labels(knot_dname_target(&rrset->rrs), NULL)
> KNOT_DNAME_MAXLABELS) {
if (knot_dname_labels(qname, NULL) - knot_dname_labels(rrset->owner, NULL) +
knot_dname_labels(knot_dname_target(&rrset->rrs), NULL) > KNOT_DNAME_MAXLABELS) {
return true;
} else if (knot_dname_size(qname) - knot_dname_size(rrset->owner) +
knot_dname_size(knot_dname_target(&rrset->rrs)) > KNOT_DNAME_MAXLEN) {
return true;
} else {
return false;
......
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