]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Set the active region for the dst_algorithm_fromprivatedns() call
authorMark Andrews <marka@isc.org>
Mon, 29 Jun 2026 22:40:15 +0000 (08:40 +1000)
committerMark Andrews <marka@isc.org>
Mon, 3 Aug 2026 23:46:56 +0000 (09:46 +1000)
dst_algorithm_fromprivatedns() reads the name with dns_name_fromwire(),
which parses only the active region of the buffer. frombuffer() did not
set it, so the name could never be parsed and every PRIVATEDNS key was
rejected with DST_R_UNSUPPORTEDALG. Document the requirement in dst.h.

lib/dns/dst_api.c
lib/dns/include/dst/dst.h

index d4307b309a8f3dfe05710ceca7f299fc0626f597..c84a7f9ba36ee128daf648de1a574d32c0cb37f3 100644 (file)
@@ -2099,6 +2099,7 @@ frombuffer(const dns_name_t *name, unsigned int alg, unsigned int flags,
 
        if (alg == DNS_KEYALG_PRIVATEDNS) {
                isc_buffer_t b = *source;
+               isc_buffer_setactive(&b, isc_buffer_remaininglength(&b));
                alg = dst_algorithm_fromprivatedns(&b);
                if (alg == 0) {
                        return DST_R_UNSUPPORTEDALG;
index 0da1c5f0d6cdfc5ab6d82d3e42cc5534bc0fa902..bb24b63c07a8270d23918113ca29eefb77305d0f 100644 (file)
@@ -226,10 +226,13 @@ dst_algorithm_fromprivateoid(isc_buffer_t *buffer);
  */
 
 dst_algorithm_t
-dst_algorithm_fromprivatedns(isc_buffer_t *buf);
+dst_algorithm_fromprivatedns(isc_buffer_t *buffer);
 /*
  * Extract the dst algorithm identifier that matches
  * the DNS name found at the start of 'buffer'.
+ *
+ * The active region needs to be set on 'buffer' as
+ * dns_name_fromwire is called.
  */
 
 bool