From: Grigorii Demidov Date: Mon, 18 Jan 2016 09:27:19 +0000 (+0100) Subject: lib/dnssec: wrong prepend_asterisk() usage was fixed, cleanup X-Git-Tag: v1.0.0-beta3~18^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e81b6f465824b6435d22390bc842ac957c1f433;p=thirdparty%2Fknot-resolver.git lib/dnssec: wrong prepend_asterisk() usage was fixed, cleanup --- diff --git a/lib/dnssec/nsec3.c b/lib/dnssec/nsec3.c index 5ea26792a..a3cb0ab63 100644 --- a/lib/dnssec/nsec3.c +++ b/lib/dnssec/nsec3.c @@ -353,7 +353,7 @@ fail: * * @param tgt Target buffer to write domain name into. * @param name Name to be added to the asterisk. - * @return 0 or error code + * @return Size of the resulting name or error code. */ static int prepend_asterisk(uint8_t *tgt, size_t maxlen, const knot_dname_t *name) { @@ -639,9 +639,10 @@ static int matches_closest_encloser_wildcard(const knot_pkt_t *pkt, knot_section uint8_t wildcard[KNOT_DNAME_MAXLEN]; int ret = prepend_asterisk(wildcard, sizeof(wildcard), encloser); - if (ret < 3) { + if (ret < 0) { return ret; } + assert(ret >= 3); int flags; for (unsigned i = 0; i < sec->count; ++i) {