aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-09-30 05:58:55 +0000
committerlloyd <[email protected]>2006-09-30 05:58:55 +0000
commit2d823dfaee1f3fe329f5b2eaf79eb3d9c27943a9 (patch)
treee90a4fca23381a0f058a5e484c9f2670a1cc9520
parent094328110e20726bfb6c03ed2989df02c95b1253 (diff)
In the keypair consistency check for encryption/decryption keys, a key
that was very small (with max_input_size() == 0) would underflow and cause an attempted allocation of a 4 gigabyte input string.
-rw-r--r--src/keypair.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/keypair.cpp b/src/keypair.cpp
index 11ddbd811..eb613b971 100644
--- a/src/keypair.cpp
+++ b/src/keypair.cpp
@@ -17,6 +17,9 @@ namespace KeyPair {
*************************************************/
void check_key(PK_Encryptor* encryptor, PK_Decryptor* decryptor)
{
+ if(encryptor->maximum_input_size() == 0)
+ return;
+
std::auto_ptr<PK_Encryptor> enc(encryptor);
std::auto_ptr<PK_Decryptor> dec(decryptor);