diff --git a/node/Identity.hpp b/node/Identity.hpp index 060b70a2c..d5d7b5144 100644 --- a/node/Identity.hpp +++ b/node/Identity.hpp @@ -25,7 +25,7 @@ #include "SHA512.hpp" #include "ECC384.hpp" -#define ZT_IDENTITY_STRING_BUFFER_LENGTH 512 +#define ZT_IDENTITY_STRING_BUFFER_LENGTH 1024 namespace ZeroTier { diff --git a/node/Utils.hpp b/node/Utils.hpp index 8556e9f7f..047a933a7 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -76,14 +76,12 @@ public: * @return Pointer to s containing hex string with trailing zero byte */ template - static ZT_ALWAYS_INLINE char *hex(I i,char *s) + static ZT_ALWAYS_INLINE char *hex(I x,char *s) { char *const r = s; - for(unsigned int i=0,b=(sizeof(i)*8);i> b) & 0xf]; - b -= 4; - *(s++) = HEXCHARS[(i >> b) & 0xf]; + for(unsigned int i=0,b=(sizeof(x)*8);i> (b -= 4)) & 0xf]; + *(s++) = HEXCHARS[(x >> (b -= 4)) & 0xf]; } *s = (char)0; return r; diff --git a/selftest.cpp b/selftest.cpp index fed229aaa..22fb02f11 100644 --- a/selftest.cpp +++ b/selftest.cpp @@ -866,19 +866,19 @@ static int testOther() for(int k=0;k<250;++k) { Dictionary<8194> *test = new Dictionary<8194>(); char key[32][16]; - char value[32][128]; + char value[32][64]; memset(key, 0, sizeof(key)); memset(value, 0, sizeof(value)); for(unsigned int q=0;q<32;++q) { - Utils::hex((uint32_t)((rand() % 1000) + (q * 1000)),key[q]); - int r = rand() % 128; + Utils::hex((uint32_t)((Utils::random() % 1000) + (q * 1000)),key[q]); + int r = (int)(Utils::random() % 64); for(int x=0;xadd(key[q],value[q],r); } for(unsigned int q=0;q<1024;++q) { - int r = rand() % 32; + int r = (int)(Utils::random() % 32); char tmp[128]; if (test->get(key[r],tmp,sizeof(tmp)) >= 0) { if (strcmp(value[r],tmp)) {