Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Fix SIGILL created when ExtendedBuffer is null
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
coneiric committed Dec 20, 2017
1 parent 5c9df9e commit c08ddc9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/router/identity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint8_t[]> null_key = std::make_unique<std::uint8_t[]>(m_ExtendedLen);
return bufbe16toh(null_key.get()); // signing key
}

CryptoKeyType IdentityEx::GetCryptoKeyType() const {
Expand All @@ -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<std::uint8_t[]> null_key = std::make_unique<std::uint8_t[]>(m_ExtendedLen - 2);
return bufbe16toh(null_key.get()); // null crypto key
}

void IdentityEx::CreateVerifier() const {
Expand Down

0 comments on commit c08ddc9

Please sign in to comment.