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 2016/04/27 22:34:17 UTC

[trafficserver] 03/05: TS-4272: Clear memory for new HostDBInfo items

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

zwoop pushed a commit to branch 6.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 81b0d74d70866bf1a82b5cf60cb70f7da6c91d65
Author: Thomas Jackson <ja...@apache.org>
AuthorDate: Fri Mar 11 16:12:05 2016 -0800

    TS-4272: Clear memory for new HostDBInfo items
    
    std::map is creating an entry, and we are setting a subset of values. Since we were not clearing the memory that we got, we end up with some non-initialized structure fields-- meaning the HostDBInfo object we return is corrupt.
    
    Fixes #523
    
    (cherry picked from commit edf9ff13db4e63ee9b5003b603439bf2aa6ff19b)
---
 iocore/hostdb/HostDB.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 5b4cabf..9a7064b 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2861,6 +2861,7 @@ ParseHostLine(RefCountedHostsFileMap *map, char *l)
       // If we don't have an entry already (host files only support single IPs for a given name)
       if (map->hosts_file_map.find(name) == map->hosts_file_map.end()) {
         HostsFileMap::mapped_type &item = map->hosts_file_map[name];
+        memset(&item, 0, sizeof(item));
         item.round_robin = false;
         item.round_robin_elt = false;
         item.reverse_dns = false;

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