From: Remi Gacogne Date: Tue, 5 May 2026 09:17:19 +0000 (+0200) Subject: dnsdist: Bail out when a `NULL` pointer is passed to `dnsdist_ffi_dnsquestion_get_pro... X-Git-Tag: auth-5.1.0~78^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c460bcf54ea31fbc4bcd0938b72fe98cf9d935bc;p=thirdparty%2Fpdns.git dnsdist: Bail out when a `NULL` pointer is passed to `dnsdist_ffi_dnsquestion_get_proxy_protocol_values` Reported by ylwango613, thanks! Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsdistdist/dnsdist-lua-ffi.cc b/pdns/dnsdistdist/dnsdist-lua-ffi.cc index f1791f4ae1..2c4af6d9ad 100644 --- a/pdns/dnsdistdist/dnsdist-lua-ffi.cc +++ b/pdns/dnsdistdist/dnsdist-lua-ffi.cc @@ -1267,14 +1267,10 @@ bool dnsdist_ffi_dnsquestion_add_proxy_protocol_values(dnsdist_ffi_dnsquestion_t size_t dnsdist_ffi_dnsquestion_get_proxy_protocol_values(dnsdist_ffi_dnsquestion_t* dnsQuestion, const dnsdist_ffi_proxy_protocol_value_t** out) { - if (dnsQuestion == nullptr || dnsQuestion->dq == nullptr || !dnsQuestion->dq->proxyProtocolValues) { + if (dnsQuestion == nullptr || dnsQuestion->dq == nullptr || !dnsQuestion->dq->proxyProtocolValues || out == nullptr) { return 0; } - if (out == nullptr) { - return dnsQuestion->proxyProtocolValuesVect->size(); - } - dnsQuestion->proxyProtocolValuesVect = std::make_unique>(dnsQuestion->dq->proxyProtocolValues->size()); for (size_t counter = 0; counter < dnsQuestion->dq->proxyProtocolValues->size(); ++counter) { const auto& entry = dnsQuestion->dq->proxyProtocolValues->at(counter);