mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed parsing error handling in pgp key parsing
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5421 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b714d68523
commit
5d289b520b
@ -607,6 +607,12 @@ bool PGPHandler::getGPGDetailsFromBinaryBlock(const unsigned char *mem_block,siz
|
||||
free(mem) ;
|
||||
//error_string.clear() ;
|
||||
|
||||
if(tmp_keyring->nkeys != 1)
|
||||
{
|
||||
std::cerr << "No or incomplete/invalid key in supplied pgp block." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
key_id = PGPIdType(tmp_keyring->keys[0].key_id).toStdString() ;
|
||||
name = std::string((char *)tmp_keyring->keys[0].uids[0].user_id) ;
|
||||
|
||||
@ -823,7 +829,10 @@ bool PGPHandler::LoadCertificateFromString(const std::string& pgp_cert,PGPIdType
|
||||
else
|
||||
std::cerr << "Key already in public keyring." << std::endl;
|
||||
|
||||
id = PGPIdType(tmp_keyring->keys[0].key_id) ;
|
||||
if(tmp_keyring->nkeys > 0)
|
||||
id = PGPIdType(tmp_keyring->keys[0].key_id) ;
|
||||
else
|
||||
return false ;
|
||||
|
||||
ops_keyring_free(tmp_keyring) ;
|
||||
free(tmp_keyring) ;
|
||||
|
Loading…
Reference in New Issue
Block a user