diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-07-17 14:21:09 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-07-17 14:21:09 -0700 |
| commit | b9e1d53d7ac4e8d19520e3063b194ee01f550198 (patch) | |
| tree | 9aad6b77f36c7f221f5d6b660e6522fc3cfaae02 /node/Capability.hpp | |
| parent | ab0806a036485979d60015a22a8e8831b68643a2 (diff) | |
| download | infinitytier-b9e1d53d7ac4e8d19520e3063b194ee01f550198.tar.gz infinitytier-b9e1d53d7ac4e8d19520e3063b194ee01f550198.zip | |
Minor cleanup.
Diffstat (limited to 'node/Capability.hpp')
| -rw-r--r-- | node/Capability.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/node/Capability.hpp b/node/Capability.hpp index 8d4b9085..d64625e6 100644 --- a/node/Capability.hpp +++ b/node/Capability.hpp @@ -420,24 +420,24 @@ public: const unsigned int rc = b.template at<uint16_t>(p); p += 2; if (rc > ZT_MAX_CAPABILITY_RULES) - throw std::runtime_error("rule overflow"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW; deserializeRules(b,p,_rules,_ruleCount,rc); _maxCustodyChainLength = (unsigned int)b[p++]; if ((_maxCustodyChainLength < 1)||(_maxCustodyChainLength > ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH)) - throw std::runtime_error("invalid max custody chain length"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW; for(unsigned int i=0;;++i) { const Address to(b.field(p,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); p += ZT_ADDRESS_LENGTH; if (!to) break; if ((i >= _maxCustodyChainLength)||(i >= ZT_MAX_CAPABILITY_CUSTODY_CHAIN_LENGTH)) - throw std::runtime_error("unterminated custody chain"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW; _custody[i].to = to; _custody[i].from.setTo(b.field(p,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); p += ZT_ADDRESS_LENGTH; if (b[p++] == 1) { if (b.template at<uint16_t>(p) != ZT_C25519_SIGNATURE_LEN) - throw std::runtime_error("invalid signature"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_INVALID_CRYPTOGRAPHIC_TOKEN; p += 2; memcpy(_custody[i].signature.data,b.field(p,ZT_C25519_SIGNATURE_LEN),ZT_C25519_SIGNATURE_LEN); p += ZT_C25519_SIGNATURE_LEN; } else { @@ -447,7 +447,7 @@ public: p += 2 + b.template at<uint16_t>(p); if (p > b.size()) - throw std::runtime_error("extended field overflow"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW; return (p - startAt); } |
