mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-20 09:46:13 +00:00
Bug fixes
This commit is contained in:
parent
0723a85ab3
commit
44878e583a
@ -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 {
|
||||
|
||||
|
@ -76,14 +76,12 @@ public:
|
||||
* @return Pointer to s containing hex string with trailing zero byte
|
||||
*/
|
||||
template<typename I>
|
||||
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<sizeof(i);++i) {
|
||||
b -= 4;
|
||||
*(s++) = HEXCHARS[(i >> b) & 0xf];
|
||||
b -= 4;
|
||||
*(s++) = HEXCHARS[(i >> b) & 0xf];
|
||||
for(unsigned int i=0,b=(sizeof(x)*8);i<sizeof(x);++i) {
|
||||
*(s++) = HEXCHARS[(x >> (b -= 4)) & 0xf];
|
||||
*(s++) = HEXCHARS[(x >> (b -= 4)) & 0xf];
|
||||
}
|
||||
*s = (char)0;
|
||||
return r;
|
||||
|
10
selftest.cpp
10
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;x<r;++x)
|
||||
value[q][x] = ("0123456789\0\t\r\n= ")[rand() % 16];
|
||||
value[q][x] = ("0123456789\0\t\r\n= ")[Utils::random() % 16];
|
||||
value[q][r] = (char)0;
|
||||
test->add(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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user