Fix network enumeration buffer size bug -- reported by user Neal Symms via LiveAgent

This commit is contained in:
Adam Ierymenko 2014-12-02 12:53:30 -08:00
parent 8c64046a53
commit 30e82a4d9c

View File

@ -993,7 +993,7 @@ ZT1_Node_NetworkList *Node::listNetworks()
unsigned long returnBufSize = sizeof(ZT1_Node_NetworkList);
for(unsigned long i=0;i<networks.size();++i) {
nconfs[i] = networks[i]->config2();
nconfs[i] = networks[i]->config2(); // note: can return NULL
ipsv[i] = networks[i]->ips();
returnBufSize += sizeof(ZT1_Node_Network) + (sizeof(ZT1_Node_PhysicalAddress) * (unsigned int)ipsv[i].size());
}
@ -1015,7 +1015,7 @@ ZT1_Node_NetworkList *Node::listNetworks()
_fillNetworkQueryResultBuffer(networks[i],nconfs[i],nbuf);
nbuf->ips = (ZT1_Node_PhysicalAddress *)buf;
buf += sizeof(ZT1_Node_PhysicalAddress);
buf += sizeof(ZT1_Node_PhysicalAddress) * ipsv[i].size();
nbuf->numIps = 0;
for(std::set<InetAddress>::iterator ip(ipsv[i].begin());ip!=ipsv[i].end();++ip) {