Avoid segfault when detecting decryption buffer size.

This commit is contained in:
Kees Cook 2005-05-16 08:50:45 +00:00 committed by Alexandre Julliard
parent dc920056b1
commit ea2fabca84
1 changed files with 1 additions and 1 deletions

View File

@ -1834,7 +1834,7 @@ BOOL WINAPI RSAENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
}
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;
if (*pdwDataLen > dwBufLen)