pwhash: return a zeroed output buffer on error paths.

This commit is contained in:
Frank Denis 2014-05-10 01:25:07 -07:00
parent 4ea26f0b8c
commit 244158ab2e

View File

@ -74,6 +74,7 @@ crypto_pwhash_scryptxsalsa208sha256(unsigned char * const out,
uint32_t p;
uint32_t r;
memset(out, 0, outlen);
if (passwdlen > SIZE_MAX || outlen > SIZE_MAX) {
errno = EFBIG;
return -1;
@ -103,6 +104,7 @@ crypto_pwhash_scryptxsalsa208sha256_str(char out[crypto_pwhash_scryptxsalsa208sh
uint32_t p;
uint32_t r;
memset(out, 0, crypto_pwhash_scryptxsalsa208sha256_STRBYTES);
if (passwdlen > SIZE_MAX) {
errno = EFBIG;
return -1;