]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Initialize printed buffer
authorPetr Menšík <pemensik@redhat.com>
Wed, 19 Jan 2022 13:47:13 +0000 (14:47 +0100)
committerMark Andrews <marka@isc.org>
Fri, 29 Apr 2022 01:22:40 +0000 (11:22 +1000)
- 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.

bin/dig/host.c

index 1a42a87386a196b0023428a60827d90d521fd502..436e9d7741306777046077285f8ba98a94fa8f61 100644 (file)
@@ -211,15 +211,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);