diff options
author | Technion <technion@lolware.net> | 2015-07-09 06:40:46 +0000 |
---|---|---|
committer | Technion <technion@lolware.net> | 2015-07-09 06:40:46 +0000 |
commit | 152eefe4ed1f53ca0bbaeccdc38e3db9704264b2 (patch) | |
tree | 5a8a06319ae74b88afb3c0e952ad40564a81f29c | |
parent | 8c06f61416a466abe985f7b342f3ee08955f09fe (diff) |
Fix for #38 - snprintf() return value check to match man page.
Many thanks to kinnison for reporting this bug.
This bug should not have a practical impact as a properly sized buffer will not overflow. It is nonetheless important to be accurate in these types of checks.
-rw-r--r-- | crypto-mcf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto-mcf.c b/crypto-mcf.c index 8ad3eb8..789aead 100644 --- a/crypto-mcf.c +++ b/crypto-mcf.c @@ -66,7 +66,7 @@ int libscrypt_mcf(uint32_t N, uint32_t r, uint32_t p, const char *salt, * in length */ s = SNPRINTF(mcf, SCRYPT_MCF_LEN, SCRYPT_MCF_ID "$%06x$%s$%s", (unsigned int)params, salt, hash); - if (s > SCRYPT_MCF_LEN) + if (s >= SCRYPT_MCF_LEN) return 0; return 1; |