Avoid segfault when detecting decryption buffer size.
This commit is contained in:
parent
dc920056b1
commit
ea2fabca84
|
@ -1834,7 +1834,7 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
|
||||||
}
|
}
|
||||||
|
|
||||||
dwEncryptedLen = (*pdwDataLen/pCryptKey->dwBlockLen+(Final?1:0))*pCryptKey->dwBlockLen;
|
dwEncryptedLen = (*pdwDataLen/pCryptKey->dwBlockLen+(Final?1:0))*pCryptKey->dwBlockLen;
|
||||||
for (i=*pdwDataLen; i<dwEncryptedLen; i++) pbData[i] = dwEncryptedLen - *pdwDataLen;
|
for (i=*pdwDataLen; i<dwEncryptedLen && i<dwBufLen; i++) pbData[i] = dwEncryptedLen - *pdwDataLen;
|
||||||
*pdwDataLen = dwEncryptedLen;
|
*pdwDataLen = dwEncryptedLen;
|
||||||
|
|
||||||
if (*pdwDataLen > dwBufLen)
|
if (*pdwDataLen > dwBufLen)
|
||||||
|
|
Loading…
Reference in New Issue