summaryrefslogtreecommitdiff
path: root/node/Dictionary.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-17 13:56:01 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-03-17 13:56:01 -0700
commitcc883cc3d81dd72427c0be0f386f39590f4578dd (patch)
tree4227f77bb0293bbc2d13240abe5149d0f13766d7 /node/Dictionary.hpp
parentdf3025554213570aca6259b30d2bd314f3628659 (diff)
parentc6a39ed927161736e44aeaa67c6783024c1fb86a (diff)
downloadinfinitytier-cc883cc3d81dd72427c0be0f386f39590f4578dd.tar.gz
infinitytier-cc883cc3d81dd72427c0be0f386f39590f4578dd.zip
Merge branch 'master' of http://10.6.6.2/zerotier/ZeroTierOne
Diffstat (limited to 'node/Dictionary.hpp')
-rw-r--r--node/Dictionary.hpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/node/Dictionary.hpp b/node/Dictionary.hpp
index 15ab9ce3..fa9e2883 100644
--- a/node/Dictionary.hpp
+++ b/node/Dictionary.hpp
@@ -61,15 +61,23 @@ public:
Dictionary(const char *s)
{
- Utils::scopy(_d,sizeof(_d),s);
+ if (s) {
+ Utils::scopy(_d,sizeof(_d),s);
+ } else {
+ _d[0] = (char)0;
+ }
}
Dictionary(const char *s,unsigned int len)
{
- if (len > (C-1))
- len = C-1;
- memcpy(_d,s,len);
- _d[len] = (char)0;
+ if (s) {
+ if (len > (C-1))
+ len = C-1;
+ memcpy(_d,s,len);
+ _d[len] = (char)0;
+ } else {
+ _d[0] = (char)0;
+ }
}
Dictionary(const Dictionary &d)
@@ -91,7 +99,12 @@ public:
*/
inline bool load(const char *s)
{
- return Utils::scopy(_d,sizeof(_d),s);
+ if (s) {
+ return Utils::scopy(_d,sizeof(_d),s);
+ } else {
+ _d[0] = (char)0;
+ return true;
+ }
}
/**