Skip to content

Commit 6e7aec4

Browse files
authored
Merge pull request #5992 from larsewi/secret
ENT-13591: Fixed buffer overflow in cf-secret when using multiple keys of different sizes
2 parents be5693d + b8d1e09 commit 6e7aec4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cf-secret/cf-secret.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ static bool RSAEncrypt(Seq *rsa_keys, const char *input_path, const char *output
343343

344344
const EVP_CIPHER *cipher = EVP_aes_256_cbc();
345345
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
346-
const int key_size = EVP_PKEY_size((EVP_PKEY*) SeqAt(evp_keys, 0));
347346

348347
/* This sequence and the 'enc_key_sizes' array are both populated by the
349348
* EVP_SealInit() call below. */
350349
Seq *enc_keys = SeqNew(n_keys, free);
351350
for (size_t i = 0; i < n_keys; i++)
352351
{
352+
const int key_size = EVP_PKEY_size((EVP_PKEY*) SeqAt(evp_keys, i));
353353
SeqAppend(enc_keys, xmalloc(key_size));
354354
}
355355
int enc_key_sizes[n_keys];

0 commit comments

Comments
 (0)