From 93de9ed59b50bb2c29c81c6537520e384f30965d Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 11 May 2023 15:27:07 +0200 Subject: [PATCH] dnsdist: Properly set the size of the UDP health-check response We forgot to resize the response buffer to what we actually got, so the initial buffer size (512) was mistakenly used later on. Technically this should not be an issue as the buffer is large enough, but that prevents us from reporting that the response was broken if it not large enough for a DNS header, for example. (cherry picked from commit 6a04912e36e32104434d2b1b0625a0de0e0c002d) --- pdns/dnsdistdist/dnsdist-healthchecks.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/pdns/dnsdistdist/dnsdist-healthchecks.cc b/pdns/dnsdistdist/dnsdist-healthchecks.cc index 4a52052276..1c3729ac7f 100644 --- a/pdns/dnsdistdist/dnsdist-healthchecks.cc +++ b/pdns/dnsdistdist/dnsdist-healthchecks.cc @@ -177,6 +177,7 @@ static void healthCheckUDPCallback(int fd, FDMultiplexer::funcparam_t& param) data->d_ds->submitHealthCheckResult(data->d_initial, false); return; } + data->d_buffer.resize(static_cast(got)); /* we are using a connected socket but hey.. */ if (from != data->d_ds->d_config.remote) { -- 2.47.2