You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/07/28 22:35:58 UTC

[trafficserver] branch 9.1.x updated: ensure hostname_offset is initialized to '0' to indicate null hostname (#8162)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
     new d2a0eae  ensure hostname_offset is initialized to '0' to indicate null hostname (#8162)
d2a0eae is described below

commit d2a0eae18c39076985e83f935613a8ed5190c6b3
Author: Brian Olsen <bn...@gmail.com>
AuthorDate: Mon Jul 26 10:54:57 2021 -0600

    ensure hostname_offset is initialized to '0' to indicate null hostname (#8162)
    
    (cherry picked from commit 732df022dead77cf09abd82805e77c6bebd2e6e3)
---
 iocore/hostdb/HostDB.cc           | 6 +++++-
 iocore/hostdb/I_HostDBProcessor.h | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 6589b21..ffdaccb 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2257,7 +2257,11 @@ struct HostDBRegressionContinuation : public Continuation {
       // since this is a lookup done, data is either hostdbInfo or nullptr
       if (r) {
         rprintf(test, "hostdbinfo r=%x\n", r);
-        rprintf(test, "hostdbinfo hostname=%s\n", r->perm_hostname());
+        char const *hname = r->perm_hostname();
+        if (nullptr == hname) {
+          hname = "(null)";
+        }
+        rprintf(test, "hostdbinfo hostname=%s\n", hname);
         rprintf(test, "hostdbinfo rr %x\n", r->rr());
         // If RR, print all of the enclosed records
         if (r->rr()) {
diff --git a/iocore/hostdb/I_HostDBProcessor.h b/iocore/hostdb/I_HostDBProcessor.h
index 06bde62..dc46976 100644
--- a/iocore/hostdb/I_HostDBProcessor.h
+++ b/iocore/hostdb/I_HostDBProcessor.h
@@ -319,7 +319,7 @@ struct HostDBInfo : public RefCountObj {
     }
   }
 
-  uint64_t key;
+  uint64_t key{0};
 
   // Application specific data. NOTE: We need an integral number of
   // these per block. This structure is 32 bytes. (at 200k hosts =
@@ -332,11 +332,11 @@ struct HostDBInfo : public RefCountObj {
     SRVInfo srv;
   } data;
 
-  unsigned int hostname_offset; // always maintain a permanent copy of the hostname for non-rev dns records.
+  unsigned int hostname_offset{0}; // always maintain a permanent copy of the hostname for non-rev dns records.
 
-  unsigned int ip_timestamp;
+  unsigned int ip_timestamp{0};
 
-  unsigned int ip_timeout_interval; // bounded between 1 and HOST_DB_MAX_TTL (0x1FFFFF, 24 days)
+  unsigned int ip_timeout_interval{0}; // bounded between 1 and HOST_DB_MAX_TTL (0x1FFFFF, 24 days)
 
   unsigned int is_srv : 1;
   unsigned int reverse_dns : 1;