You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2017/05/11 00:43:58 UTC

[trafficserver] branch master updated: Coverity issues in HostDB.cc

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

sorber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  decf159   Coverity issues in HostDB.cc
decf159 is described below

commit decf159c6ef3dcedf7a8b641db799312bf6abd4b
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Wed May 10 15:14:36 2017 -0400

    Coverity issues in HostDB.cc
    
    Fixes Coverity issues:
    
          CID 1022118
          CID 1022119
          CID 1258629
---
 iocore/hostdb/HostDB.cc | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 6f957d9..a5c2db0 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -710,6 +710,8 @@ HostDBProcessor::getSRVbyname_imm(Continuation *cont, process_srv_info_pfn proce
   EThread *thread   = cont->mutex->thread_holding;
   ProxyMutex *mutex = thread->mutex.get();
 
+  ink_assert(nullptr != hostname);
+
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
     force_dns = true;
   else if (opt.flags & HOSTDB_FORCE_DNS_RELOAD) {
@@ -728,7 +730,7 @@ HostDBProcessor::getSRVbyname_imm(Continuation *cont, process_srv_info_pfn proce
   }
 
   md5.host_name = hostname;
-  md5.host_len  = hostname ? (len ? len : strlen(hostname)) : 0;
+  md5.host_len  = len ? len : strlen(hostname);
   md5.port      = 0;
   md5.db_mark   = HOSTDB_MARK_SRV;
   md5.refresh();
@@ -784,6 +786,8 @@ HostDBProcessor::getbyname_imm(Continuation *cont, process_hostdb_info_pfn proce
   ProxyMutex *mutex = thread->mutex.get();
   HostDBMD5 md5;
 
+  ink_assert(nullptr != hostname);
+
   if (opt.flags & HOSTDB_FORCE_DNS_ALWAYS)
     force_dns = true;
   else if (opt.flags & HOSTDB_FORCE_DNS_RELOAD) {
@@ -799,7 +803,7 @@ HostDBProcessor::getbyname_imm(Continuation *cont, process_hostdb_info_pfn proce
     return ACTION_RESULT_DONE;
   }
 
-  md5.set_host(hostname, hostname ? (len ? len : strlen(hostname)) : 0);
+  md5.set_host(hostname, len ? len : strlen(hostname));
   md5.port    = opt.port;
   md5.db_mark = db_mark_for(opt.host_res_style);
   md5.refresh();
@@ -2133,13 +2137,13 @@ struct HostFilePair {
 
 struct HostDBFileContinuation : public Continuation {
   typedef HostDBFileContinuation self;
-
-  int idx;          ///< Working index.
-  const char *name; ///< Host name (just for debugging)
-  INK_MD5 md5;      ///< Key for entry.
   typedef std::vector<INK_MD5> Keys;
-  Keys *keys;          ///< Entries from file.
-  ats_scoped_str path; ///< Used to keep the host file name around.
+
+  int idx          = 0;       ///< Working index.
+  const char *name = nullptr; ///< Host name (just for debugging)
+  Keys *keys       = nullptr; ///< Entries from file.
+  INK_MD5 md5;                ///< Key for entry.
+  ats_scoped_str path;        ///< Used to keep the host file name around.
 
   HostDBFileContinuation() : Continuation(nullptr) {}
   /// Finish update

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].