mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fix network enumeration buffer size bug -- reported by user Neal Symms via LiveAgent
This commit is contained in:
parent
8c64046a53
commit
30e82a4d9c
1 changed files with 2 additions and 2 deletions
|
@ -993,7 +993,7 @@ ZT1_Node_NetworkList *Node::listNetworks()
|
||||||
|
|
||||||
unsigned long returnBufSize = sizeof(ZT1_Node_NetworkList);
|
unsigned long returnBufSize = sizeof(ZT1_Node_NetworkList);
|
||||||
for(unsigned long i=0;i<networks.size();++i) {
|
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();
|
ipsv[i] = networks[i]->ips();
|
||||||
returnBufSize += sizeof(ZT1_Node_Network) + (sizeof(ZT1_Node_PhysicalAddress) * (unsigned int)ipsv[i].size());
|
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);
|
_fillNetworkQueryResultBuffer(networks[i],nconfs[i],nbuf);
|
||||||
|
|
||||||
nbuf->ips = (ZT1_Node_PhysicalAddress *)buf;
|
nbuf->ips = (ZT1_Node_PhysicalAddress *)buf;
|
||||||
buf += sizeof(ZT1_Node_PhysicalAddress);
|
buf += sizeof(ZT1_Node_PhysicalAddress) * ipsv[i].size();
|
||||||
|
|
||||||
nbuf->numIps = 0;
|
nbuf->numIps = 0;
|
||||||
for(std::set<InetAddress>::iterator ip(ipsv[i].begin());ip!=ipsv[i].end();++ip) {
|
for(std::set<InetAddress>::iterator ip(ipsv[i].begin());ip!=ipsv[i].end();++ip) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue