summaryrefslogtreecommitdiff
path: root/node/Identity.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Identity.hpp')
-rw-r--r--node/Identity.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/node/Identity.hpp b/node/Identity.hpp
index dfa1c7a9..cb911b92 100644
--- a/node/Identity.hpp
+++ b/node/Identity.hpp
@@ -256,13 +256,15 @@ public:
p += ZT_ADDRESS_LENGTH;
if (b[p++] != IDENTITY_TYPE_C25519)
- throw std::invalid_argument("Identity: deserialize(): unsupported identity type");
+ throw std::invalid_argument("unsupported identity type");
memcpy(_publicKey.data,b.field(p,_publicKey.size()),_publicKey.size());
p += _publicKey.size();
- unsigned int privateKeyLength = b[p++];
- if ((privateKeyLength)&&(privateKeyLength == ZT_C25519_PRIVATE_KEY_LEN)) {
+ unsigned int privateKeyLength = (unsigned int)b[p++];
+ if (privateKeyLength) {
+ if (privateKeyLength != ZT_C25519_PRIVATE_KEY_LEN)
+ throw std::invalid_argument("invalid private key");
_privateKey = new C25519::Private();
memcpy(_privateKey->data,b.field(p,ZT_C25519_PRIVATE_KEY_LEN),ZT_C25519_PRIVATE_KEY_LEN);
p += ZT_C25519_PRIVATE_KEY_LEN;