From dba033ad41f376b61f96a11d20b8012a6d04ed83 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 5 Oct 2020 12:32:00 +0200 Subject: [PATCH] NULL check for return value of mutable_response() as noted by CodeQL --- pdns/rec-protobuf.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pdns/rec-protobuf.cc b/pdns/rec-protobuf.cc index af22526170..e5a7f4e8b4 100644 --- a/pdns/rec-protobuf.cc +++ b/pdns/rec-protobuf.cc @@ -14,6 +14,9 @@ void RecProtoBufMessage::clearUDR() { #ifdef HAVE_PROTOBUF auto response = d_message.mutable_response(); + if (!response) { + return; + } const int count = response->rrs_size(); for (int idx = 0; idx < count; idx++) { auto rr = response->mutable_rrs(idx); -- 2.47.2