From 145e36925f9ceab52f69bdaf93490ba4110bca5e Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 23 Feb 2017 22:08:25 -0500 Subject: [PATCH] check certificate size --- Identity.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Identity.cpp b/Identity.cpp index 68659e2b..aecb11cc 100644 --- a/Identity.cpp +++ b/Identity.cpp @@ -302,14 +302,14 @@ namespace data SigningKeyType IdentityEx::GetSigningKeyType () const { - if (m_StandardIdentity.certificate[0] == CERTIFICATE_TYPE_KEY && m_ExtendedBuffer) + if (m_StandardIdentity.certificate[0] == CERTIFICATE_TYPE_KEY && m_ExtendedLen >= 2) return bufbe16toh (m_ExtendedBuffer); // signing key return SIGNING_KEY_TYPE_DSA_SHA1; } CryptoKeyType IdentityEx::GetCryptoKeyType () const { - if (m_StandardIdentity.certificate[0] == CERTIFICATE_TYPE_KEY && m_ExtendedBuffer) + if (m_StandardIdentity.certificate[0] == CERTIFICATE_TYPE_KEY && m_ExtendedLen >= 4) return bufbe16toh (m_ExtendedBuffer + 2); // crypto key return CRYPTO_KEY_TYPE_ELGAMAL; }