summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-12-02 12:53:30 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-12-02 12:53:30 -0800
commit30e82a4d9c8f4fc336373ea8a98571c890298379 (patch)
tree68dfe0432378872e25560bb754ecec3127cfedd9 /node
parent8c64046a5362432160e4db3e1079c755ab321caf (diff)
downloadinfinitytier-30e82a4d9c8f4fc336373ea8a98571c890298379.tar.gz
infinitytier-30e82a4d9c8f4fc336373ea8a98571c890298379.zip
Fix network enumeration buffer size bug -- reported by user Neal Symms via LiveAgent
Diffstat (limited to 'node')
-rw-r--r--node/Node.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index fc459af5..19badced 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -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) {