From c08ddc9d1b3da3335fcd17a29ac6fc3a845a3ea6 Mon Sep 17 00:00:00 2001 From: oneiric Date: Tue, 19 Dec 2017 22:41:37 -0700 Subject: [PATCH] Fix SIGILL created when ExtendedBuffer is null When m_ExtendedBuffer is a null pointer, or the m_StandardIdentity.certificate.type is not "Key", a null buffer is now returned. Likely not the correct solution, only fixes SIGILL runtime interrupt. --- src/core/router/identity.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/router/identity.cc b/src/core/router/identity.cc index 55b42edb..2c3c6436 100644 --- a/src/core/router/identity.cc +++ b/src/core/router/identity.cc @@ -356,6 +356,8 @@ SigningKeyType IdentityEx::GetSigningKeyType() const { return bufbe16toh(m_ExtendedBuffer.get()); // signing key // TODO(unassigned): should an exception be raised here? // since an unsupported setup is used when the above condition is false? + std::unique_ptr null_key = std::make_unique(m_ExtendedLen); + return bufbe16toh(null_key.get()); // signing key } CryptoKeyType IdentityEx::GetCryptoKeyType() const { @@ -364,6 +366,8 @@ CryptoKeyType IdentityEx::GetCryptoKeyType() const { return bufbe16toh(m_ExtendedBuffer.get() + 2); // crypto key // TODO(unassigned): should an exception be raised here? // since an unsupported setup is used when the above condition is false? + std::unique_ptr null_key = std::make_unique(m_ExtendedLen - 2); + return bufbe16toh(null_key.get()); // null crypto key } void IdentityEx::CreateVerifier() const {