From 6276ccfba9ea29d2fc78293968246af9c2e2c800 Mon Sep 17 00:00:00 2001 From: Zdenek Prikryl Date: Thu, 26 Feb 2009 12:16:12 +0100 Subject: added check for publick key --- lib/MiddleWare/RPMInfo.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/MiddleWare/RPMInfo.cpp b/lib/MiddleWare/RPMInfo.cpp index 605f698c..64f0628a 100644 --- a/lib/MiddleWare/RPMInfo.cpp +++ b/lib/MiddleWare/RPMInfo.cpp @@ -17,7 +17,12 @@ void CRPMInfo::LoadOpenGPGPublicKey(const std::string& pFileName) uint8_t* pkt = NULL; size_t pklen; pgpKeyID_t keyID; - pgpReadPkts(pFileName.c_str(), &pkt, &pklen); + if (pgpReadPkts(pFileName.c_str(), &pkt, &pklen) != PGPARMOR_PUBKEY) + { + free(pkt); + std::cerr << "CRPMInfo::LoadOpenGPGPublicKey(): Can not load publick key " + pFileName << std::endl; + return; + } if (pgpPubkeyFingerprint(pkt, pklen, keyID) == 0) { char* fedoraFingerprint = pgpHexStr(keyID, sizeof(keyID)); @@ -26,10 +31,7 @@ void CRPMInfo::LoadOpenGPGPublicKey(const std::string& pFileName) m_setFingerprints.insert(fedoraFingerprint); } } - if (pkt) - { - free(pkt); - } + free(pkt); } bool CRPMInfo::CheckFingerprint(const std::string& pPackage) -- cgit