Commit c958a71d authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Don't set salt's cbData unless allocation succeeds. Fixes Coverity id 133.

parent 84266fc6
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment