]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: resolvers: stop clearing the DNS response buffer
authorManu Nicolas <e.nicolas@criteo.com>
Tue, 1 Sep 2026 10:44:45 +0000 (10:44 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Sep 2026 15:58:52 +0000 (17:58 +0200)
resolv_process_responses() clears the whole response buffer before
each receive. The receive operation supplies the message length and
all parser accesses are bounded by the corresponding end pointer, so
no byte beyond the received message is observed.

Remove the unnecessary buffer clear.

src/resolvers.c

index 92c4567a06e64871ec6deb2c37dc0d512caeddf7..0dc4787bf46dfbd94fcd736725d849d1ca723c27 100644 (file)
@@ -2341,7 +2341,6 @@ static int resolv_process_responses(struct dns_nameserver *ns)
        /* process all pending input messages */
        while (1) {
                /* read message received */
-               memset(buf, '\0', resolvers->accepted_payload_size + 1);
                if ((buflen = dns_recv_nameserver(ns, (void *)buf, sizeof(buf))) <= 0) {
                        break;
                }