Skip to content

Commit edf9ff1

Browse files
committed
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
1 parent 0e419b4 commit edf9ff1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

iocore/hostdb/HostDB.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,6 +2862,7 @@ ParseHostLine(RefCountedHostsFileMap *map, char *l)
28622862
// If we don't have an entry already (host files only support single IPs for a given name)
28632863
if (map->hosts_file_map.find(name) == map->hosts_file_map.end()) {
28642864
HostsFileMap::mapped_type &item = map->hosts_file_map[name];
2865+
memset(&item, 0, sizeof(item));
28652866
item.round_robin = false;
28662867
item.round_robin_elt = false;
28672868
item.reverse_dns = false;

0 commit comments

Comments
 (0)