mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
crypt32: Don't set salt's cbData unless allocation succeeds. Fixes Coverity id 133.
This commit is contained in:
parent
84266fc6f6
commit
c958a71df9
@ -607,8 +607,7 @@ BOOL fill_protect_data(struct protect_data_t * pInfo, LPCWSTR szDataDescr,
|
||||
pInfo->hash_len=CRYPT32_PROTECTDATA_HASH_LEN;
|
||||
|
||||
/* allocate memory to hold a salt */
|
||||
pInfo->salt.cbData=CRYPT32_PROTECTDATA_SALT_LEN;
|
||||
if ((pInfo->salt.pbData=CryptMemAlloc(pInfo->salt.cbData)))
|
||||
if ((pInfo->salt.pbData=CryptMemAlloc(CRYPT32_PROTECTDATA_SALT_LEN)))
|
||||
{
|
||||
/* generate random salt */
|
||||
if (!CryptGenRandom(hProv, pInfo->salt.cbData, pInfo->salt.pbData))
|
||||
@ -617,6 +616,7 @@ BOOL fill_protect_data(struct protect_data_t * pInfo, LPCWSTR szDataDescr,
|
||||
free_protect_data(pInfo);
|
||||
return FALSE;
|
||||
}
|
||||
pInfo->salt.cbData=CRYPT32_PROTECTDATA_SALT_LEN;
|
||||
}
|
||||
|
||||
/* debug: show our salt */
|
||||
|
Loading…
Reference in New Issue
Block a user