Add defensive NULL guard in escrypt_r

This commit is contained in:
Frank Denis
2026-01-05 23:51:23 +01:00
parent f703a31935
commit b000439e01
@@ -171,7 +171,7 @@ escrypt_r(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
}
need = prefixlen + saltlen + 1 +
crypto_pwhash_scryptsalsa208sha256_STRHASHBYTES_ENCODED + 1;
if (need > buflen || need < saltlen) {
if (buf == NULL || need > buflen || need < saltlen) {
return NULL;
}
#ifdef HAVE_EMMINTRIN_H