diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 013450c55..b43102df3 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -1217,6 +1217,10 @@ bool AuthSSL::VerifySignBin(std::string pid, } EVP_PKEY *peerkey = peer->certificate->cert_info->key->pkey; + + if(peerkey == NULL) + return false ; + EVP_MD_CTX *mdctx = EVP_MD_CTX_create(); if (0 == EVP_VerifyInit(mdctx, EVP_sha1())) @@ -1235,6 +1239,12 @@ bool AuthSSL::VerifySignBin(std::string pid, return false; } + if(signlen == 0 || sign == NULL) + { + EVP_MD_CTX_destroy(mdctx); + return false ; + } + if (0 == EVP_VerifyFinal(mdctx, sign, signlen, peerkey)) { std::cerr << "EVP_VerifyFinal Failure!" << std::endl;