From 1e88c0196c427de538f8ddfd6c1c3c7dd72f11d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 19 Jan 2022 14:47:13 +0100 Subject: [PATCH] Initialize printed buffer - var_decl: Declaring variable "tbuf" without initializer - assign: Assigning: "target.base" = "tbuf", which points to uninitialized data - assign: Assigning: "r.base" = "target.base", which points to uninitialized data I expect it would correctly initialize length always. Add simple initialization to silent coverity. (cherry picked from commit 59132bd3ec8a9f648a1e1cf59f5f3b2d59f17927) Conflict: NA Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/1e88c0196c427de538f8ddfd6c1c3c7dd72f11d5 --- bin/dig/host.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bin/dig/host.c b/bin/dig/host.c index 646c89783e..971cd974b7 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -208,15 +208,9 @@ printsection(dns_message_t *msg, dns_section_t sectionid, isc_result_t result, loopresult; isc_region_t r; dns_name_t empty_name; - char tbuf[4096]; + char tbuf[4096] = { 0 }; bool first; - bool no_rdata; - - if (sectionid == DNS_SECTION_QUESTION) { - no_rdata = true; - } else { - no_rdata = false; - } + bool no_rdata = (sectionid == DNS_SECTION_QUESTION); if (headers) { printf(";; %s SECTION:\n", section_name); -- 2.23.0