diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 6e82769ae..8695280a7 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -1207,7 +1207,7 @@ bool p3IdService::encryptData( const uint8_t* decrypted_data, for( int i=0; i < maxRounds; ++i ) { for( std::set::iterator it = keyNotYetFoundIds.begin(); - it !=keyNotYetFoundIds.end(); ++it ) + it !=keyNotYetFoundIds.end(); ) { RsTlvPublicRSAKey encryption_key; if(getKey(**it, encryption_key) && !encryption_key.keyId.isNull()) @@ -1215,6 +1215,10 @@ bool p3IdService::encryptData( const uint8_t* decrypted_data, encryption_keys.push_back(encryption_key); it = keyNotYetFoundIds.erase(it); } + else + { + ++it; + } } if(keyNotYetFoundIds.empty()) break; @@ -1336,7 +1340,7 @@ bool p3IdService::decryptData( const uint8_t* encrypted_data, for( int i=0; i < maxRounds; ++i ) { for( std::set::iterator it = keyNotYetFoundIds.begin(); - it !=keyNotYetFoundIds.end(); ++it ) + it !=keyNotYetFoundIds.end(); ) { RsTlvPrivateRSAKey decryption_key; if( getPrivateKey(**it, decryption_key) @@ -1345,6 +1349,10 @@ bool p3IdService::decryptData( const uint8_t* encrypted_data, decryption_keys.push_back(decryption_key); it = keyNotYetFoundIds.erase(it); } + else + { + ++it; + } } if(keyNotYetFoundIds.empty()) break;