mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-21 05:53:09 +00:00
Initialize C arrays to NULL in NetworkConfig() constructor
This commit is contained in:
parent
8ac42b4600
commit
ee91c81799
@ -22,7 +22,7 @@ namespace ZeroTier {
|
|||||||
bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,bool includeLegacy) const
|
bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,bool includeLegacy) const
|
||||||
{
|
{
|
||||||
Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY> *tmp = new Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY>();
|
Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY> *tmp = new Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY>();
|
||||||
char tmp2[128];
|
char tmp2[128] = {0};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
d.clear();
|
d.clear();
|
||||||
@ -84,7 +84,7 @@ bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,b
|
|||||||
if (((int)lastrt < 32)||(lastrt == ZT_NETWORK_RULE_MATCH_ETHERTYPE)) {
|
if (((int)lastrt < 32)||(lastrt == ZT_NETWORK_RULE_MATCH_ETHERTYPE)) {
|
||||||
if (ets.length() > 0)
|
if (ets.length() > 0)
|
||||||
ets.push_back(',');
|
ets.push_back(',');
|
||||||
char tmp2[16];
|
char tmp2[16] = {0};
|
||||||
ets.append(Utils::hex((uint16_t)et,tmp2));
|
ets.append(Utils::hex((uint16_t)et,tmp2));
|
||||||
}
|
}
|
||||||
et = 0;
|
et = 0;
|
||||||
@ -104,7 +104,7 @@ bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,b
|
|||||||
if ((this->specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0) {
|
if ((this->specialists[i] & ZT_NETWORKCONFIG_SPECIALIST_TYPE_ACTIVE_BRIDGE) != 0) {
|
||||||
if (ab.length() > 0)
|
if (ab.length() > 0)
|
||||||
ab.push_back(',');
|
ab.push_back(',');
|
||||||
char tmp2[16];
|
char tmp2[16] = {0};
|
||||||
ab.append(Address(this->specialists[i]).toString(tmp2));
|
ab.append(Address(this->specialists[i]).toString(tmp2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ bool NetworkConfig::fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACI
|
|||||||
|
|
||||||
if (d.getUI(ZT_NETWORKCONFIG_DICT_KEY_VERSION,0) < 6) {
|
if (d.getUI(ZT_NETWORKCONFIG_DICT_KEY_VERSION,0) < 6) {
|
||||||
#ifdef ZT_SUPPORT_OLD_STYLE_NETCONF
|
#ifdef ZT_SUPPORT_OLD_STYLE_NETCONF
|
||||||
char tmp2[1024];
|
char tmp2[1024] = {0};
|
||||||
|
|
||||||
// Decode legacy fields if version is old
|
// Decode legacy fields if version is old
|
||||||
if (d.getB(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST_OLD))
|
if (d.getB(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST_OLD))
|
||||||
|
@ -226,9 +226,16 @@ public:
|
|||||||
capabilityCount(0),
|
capabilityCount(0),
|
||||||
tagCount(0),
|
tagCount(0),
|
||||||
certificateOfOwnershipCount(0),
|
certificateOfOwnershipCount(0),
|
||||||
|
capabilities(),
|
||||||
|
tags(),
|
||||||
|
certificatesOfOwnership(),
|
||||||
type(ZT_NETWORK_TYPE_PRIVATE)
|
type(ZT_NETWORK_TYPE_PRIVATE)
|
||||||
{
|
{
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
|
memset(specialists, 0, sizeof(uint64_t)*ZT_MAX_NETWORK_SPECIALISTS);
|
||||||
|
memset(routes, 0, sizeof(ZT_VirtualNetworkRoute)*ZT_MAX_NETWORK_ROUTES);
|
||||||
|
memset(staticIps, 0, sizeof(InetAddress)*ZT_MAX_ZT_ASSIGNED_ADDRESSES);
|
||||||
|
memset(rules, 0, sizeof(ZT_VirtualNetworkRule)*ZT_MAX_NETWORK_RULES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user