From b9e1d53d7ac4e8d19520e3063b194ee01f550198 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 17 Jul 2017 14:21:09 -0700 Subject: Minor cleanup. --- node/Capability.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'node/Capability.hpp') 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(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(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(p); if (p > b.size()) - throw std::runtime_error("extended field overflow"); + throw ZT_EXCEPTION_INVALID_SERIALIZED_DATA_OVERFLOW; return (p - startAt); } -- cgit v1.2.3