From edf9ff13db4e63ee9b5003b603439bf2aa6ff19b Mon Sep 17 00:00:00 2001 From: Thomas Jackson Date: Fri, 11 Mar 2016 16:12:05 -0800 Subject: [PATCH] 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 --- iocore/hostdb/HostDB.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index c4de47da41a..298501609b1 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;