]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix test code to allow empty hex answer packets from testbound.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Mar 2026 14:39:27 +0000 (15:39 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 27 Mar 2026 14:39:27 +0000 (15:39 +0100)
doc/Changelog
testcode/testpkts.c

index 31216df8c3b0af8030aa61793608c8243c7e4698..1d0e2add1193d1d5e252c5ddf145916047dbd749 100644 (file)
@@ -1,5 +1,6 @@
 27 March 2026: Wouter
        - Fix to allow the control-interface config to use ip@port notation.
+       - Fix test code to allow empty hex answer packets from testbound.
 
 24 March 2026: Wouter
        - Fix to check for invalid http content length and chunk size,
index 8b92df2e729cf37ce8a9b144dc6ec16e3673fc7a..93f2add94fa46d14c05ce666860bd9ea9a571c55 100644 (file)
@@ -1774,11 +1774,14 @@ adjust_packet(struct entry* match, uint8_t** answer_pkt, size_t *answer_len,
                memmove(res+LDNS_HEADER_SIZE+dlen+4,
                        orig+LDNS_HEADER_SIZE+olen+4,
                        reslen-(LDNS_HEADER_SIZE+dlen+4));
+       } else if(origlen == 0) {
+               res = NULL;
+               reslen = 0;
        } else {
                res = memdup(orig, origlen);
                reslen = origlen;
        }
-       if(!res) {
+       if(!res && reslen > 0) {
                verbose(1, "out of memory; send without adjust\n");
                return;
        }