trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackso...@apache.org
Subject trafficserver git commit: TS-4272: Clear memory for new HostDBInfo items
Date Mon, 14 Mar 2016 16:20:01 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 0e419b47c -> edf9ff13d


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


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/edf9ff13
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/edf9ff13
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/edf9ff13

Branch: refs/heads/master
Commit: edf9ff13db4e63ee9b5003b603439bf2aa6ff19b
Parents: 0e419b4
Author: Thomas Jackson <jacksontj@apache.org>
Authored: Fri Mar 11 16:12:05 2016 -0800
Committer: Thomas Jackson <jacksontj.89@gmail.com>
Committed: Mon Mar 14 09:19:38 2016 -0700

----------------------------------------------------------------------
 iocore/hostdb/HostDB.cc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/edf9ff13/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index c4de47d..2985016 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2862,6 +2862,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;


Mime
View raw message