mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-01 18:56:23 -04:00
Fix crash in p3Peers::loadCertificateFromString
This function is part of the public API so it must be safe to call with any input, before this commit if would crash if feeded with a broken or empty certificate radix string.
This commit is contained in:
parent
fc14300b06
commit
15b729b35c
3 changed files with 113 additions and 65 deletions
|
@ -1213,17 +1213,27 @@ std::string p3Peers::GetRetroshareInvite(
|
|||
|
||||
//===========================================================================
|
||||
|
||||
bool p3Peers::loadCertificateFromString(const std::string& cert, RsPeerId& ssl_id, RsPgpId& gpg_id, std::string& error_string)
|
||||
bool p3Peers::loadCertificateFromString(
|
||||
const std::string& cert, RsPeerId& ssl_id,
|
||||
RsPgpId& gpg_id, std::string& error_string )
|
||||
{
|
||||
RsCertificate crt(cert) ;
|
||||
RsPgpId gpgid ;
|
||||
RsCertificate crt;
|
||||
uint32_t errNum = 0;
|
||||
if(!crt.initializeFromString(cert,errNum))
|
||||
{
|
||||
error_string = "RsCertificate failed with errno: "
|
||||
+ std::to_string(errNum) + " parsing: " + cert;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool res = AuthGPG::getAuthGPG()->LoadCertificateFromString(crt.armouredPGPKey(),gpgid,error_string) ;
|
||||
RsPgpId gpgid;
|
||||
bool res = AuthGPG::getAuthGPG()->
|
||||
LoadCertificateFromString(crt.armouredPGPKey(), gpgid,error_string);
|
||||
|
||||
gpg_id = gpgid;
|
||||
ssl_id = crt.sslid() ;
|
||||
ssl_id = crt.sslid();
|
||||
|
||||
return res ;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool p3Peers::loadDetailsFromStringCert( const std::string &certstr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue