From: Remi Gacogne Date: Thu, 11 May 2023 13:27:07 +0000 (+0200) Subject: dnsdist: Properly set the size of the UDP health-check response X-Git-Tag: dnsdist-1.8.1~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93de9ed59b50bb2c29c81c6537520e384f30965d;p=thirdparty%2Fpdns.git 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) --- 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) {