crypto/weakcryptospi/source/spi/cryptospiutil.cpp
changeset 98 7355aab40bca
parent 8 35751d3474b7
child 96 a71299154b21
child 108 ca9a0fc2f082
--- a/crypto/weakcryptospi/source/spi/cryptospiutil.cpp	Wed Aug 18 11:33:05 2010 +0300
+++ b/crypto/weakcryptospi/source/spi/cryptospiutil.cpp	Thu Sep 02 22:21:47 2010 +0300
@@ -85,21 +85,25 @@
 
 TInt CryptoSpiUtil::RetrieveCharacteristicsL(TInt32 aInterface, RDesReadStream& aStream, RBuf8& aBuf, TInt& aCount)
 	{
-	TBuf8<KMaxFileName> buf;
+	// first we are only trying to retrieve the length of the buffer
+	TBuf8<sizeof(TInt32)> buf;
 	TInt testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
 	if (testResult==KErrNotFound)
 		{
 		//run the exe to Publish the properties
 		RunCryptoSpiPropertySetupExe();
+		// testresult would be checked outside the loop
 		testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf);
-		if (testResult==KErrNotFound)
-			{
-			//Error
-			User::Leave(testResult);
-			}
 		}
 	
-	//Try to read the length first
+	// overflow will occur as we are only retrieving the length first.
+	// any other error we should leave
+	if(testResult != KErrOverflow)
+		{
+		User::LeaveIfError(testResult);
+		}
+	
+	//read the length
 	RDesReadStream rStream(buf);
 	TInt32 len=rStream.ReadInt32L();