diff -r a675745f8b2e -r 7355aab40bca crypto/weakcryptospi/source/spi/cryptospiutil.cpp --- 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 buf; + // first we are only trying to retrieve the length of the buffer + TBuf8 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();