]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix missing EVP_CIPHER_get_iv_length() guard in PKCS5_pbe2_set_scrypt
authorWeidong Wang <kenazcharisma@gmail.com>
Sat, 21 Mar 2026 15:41:49 +0000 (10:41 -0500)
committerTomas Mraz <tomas@openssl.foundation>
Fri, 27 Mar 2026 16:14:16 +0000 (17:14 +0100)
commitb3a1adf8dbe3ed6ac2f405960c9ecc755ac6ca36
treef1ce8a5199895505df31e18ff3b56b922cfda993
parent103e9effec9fb5bbadbe72b1a266aaa8f9c36ad1
Fix missing EVP_CIPHER_get_iv_length() guard in PKCS5_pbe2_set_scrypt

Store the return value of EVP_CIPHER_get_iv_length() in a local variable
and guard with (ivlen > 0) before passing to memcpy/RAND_bytes, matching
the pattern already used in p5_pbev2.c. Without this, a negative return
value (-1) is implicitly converted to SIZE_MAX when cast to size_t,
causing a stack buffer overflow on iv[EVP_MAX_IV_LENGTH].

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Fri Mar 27 16:14:09 2026
(Merged from https://github.com/openssl/openssl/pull/30510)

(cherry picked from commit 3e903838e341e9fc884c4d87e4a295d4a722414b)
crypto/asn1/p5_scrypt.c