From 95dea1d7efea2a3eee473158c824275f9e07915e Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sat, 12 Jan 2019 14:23:46 -0800 Subject: e_tpm2: fix intermittent segfault with importable keys The written parameter on the import unmarshal isn't set meaning it contains a bogus value. Occasionally this value causes a segfault, so fix by setting the value to 0. Signed-off-by: James Bottomley --- e_tpm2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/e_tpm2.c b/e_tpm2.c index 532db0e..167c3bf 100644 --- a/e_tpm2.c +++ b/e_tpm2.c @@ -517,6 +517,7 @@ static int tpm2_engine_load_key_core(ENGINE *e, EVP_PKEY **ppkey, } buf = priv_2b.t.buffer; size = sizeof(priv_2b.t.buffer); + written = 0; TSS_TPM2B_PRIVATE_Marshal(&iout.outPrivate, &written, &buf, &size); app_data->priv = OPENSSL_malloc(written); -- cgit 1.2.3-korg