Add missing data length check
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
83ad0ef45d
commit
67805dc9d1
@ -411,6 +411,8 @@ namespace eap
|
|||||||
throw winstd::win_runtime_error(__FUNCTION__ " Key import failed.");
|
throw winstd::win_runtime_error(__FUNCTION__ " Key import failed.");
|
||||||
|
|
||||||
// Import the 256-bit AES session key.
|
// Import the 256-bit AES session key.
|
||||||
|
if (size < 268)
|
||||||
|
throw std::invalid_argument(__FUNCTION__ " Encrypted data too short.");
|
||||||
winstd::crypt_key key_aes;
|
winstd::crypt_key key_aes;
|
||||||
if (!CryptImportKey(hProv, reinterpret_cast<LPCBYTE>(data), 268, key_rsa, 0, &key_aes))
|
if (!CryptImportKey(hProv, reinterpret_cast<LPCBYTE>(data), 268, key_rsa, 0, &key_aes))
|
||||||
throw winstd::win_runtime_error(__FUNCTION__ " CryptImportKey failed.");
|
throw winstd::win_runtime_error(__FUNCTION__ " CryptImportKey failed.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user