]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dns_qpkey_toname failed to reset name correctly
authorMark Andrews <marka@isc.org>
Tue, 16 Apr 2024 23:40:05 +0000 (09:40 +1000)
committerMark Andrews <marka@isc.org>
Thu, 18 Apr 2024 00:17:48 +0000 (00:17 +0000)
This could lead to a mismatch between name->length and the rest
of the name structure.

lib/dns/qp.c

index dff011ba6684b9ebd5f21baf77a06a7f2922fea4..686c3561f5f35eb9203490ac26678d2dabaad629 100644 (file)
@@ -259,13 +259,12 @@ dns_qpkey_toname(const dns_qpkey_t key, size_t keylen, dns_name_t *name) {
        REQUIRE(name->buffer != NULL);
        REQUIRE(name->offsets != NULL);
 
+       dns_name_reset(name);
+
        if (keylen == 0) {
-               dns_name_reset(name);
                return;
        }
 
-       isc_buffer_clear(name->buffer);
-
        /* Scan the key looking for label boundaries */
        for (offset = 0; offset <= keylen; offset++) {
                INSIST(key[offset] >= SHIFT_NOBYTE &&