Browse Source

CORE: Fix small bug in passphrase caching

Passphrase caching didn't allocate memory when it got to cache an
empty string, leading to a crash.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12587)
master
Richard Levitte 2 years ago
parent
commit
67b6401356
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      crypto/passphrase.c

+ 2
- 1
crypto/passphrase.c View File

@ -273,7 +273,8 @@ int ossl_pw_get_passphrase(char *pass, size_t pass_size, size_t *pass_len,
do_cache:
if (ret && data->flag_cache_passphrase) {
if (*pass_len > data->cached_passphrase_len) {
if (data->cached_passphrase == NULL
|| *pass_len > data->cached_passphrase_len) {
void *new_cache =
OPENSSL_clear_realloc(data->cached_passphrase,
data->cached_passphrase_len,


Loading…
Cancel
Save