40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
From 285667d640b8dd7d2d80e0c5d5fcc44f6abad442 Mon Sep 17 00:00:00 2001
|
|
From: Juergen Repp <juergen.repp@sit.fraunhofer.de>
|
|
Date: Mon, 27 Apr 2020 16:33:16 +0200
|
|
Subject: [PATCH 1/4] ESYS: Fix initialization of app data in Esys_Initialize
|
|
(Fixes #1704).
|
|
|
|
An unintended free of the tcti parameter in cleanup was possible.
|
|
|
|
Signed-off-by: Juergen Repp <juergen.repp@sit.fraunhofer.de>
|
|
---
|
|
src/tss2-esys/esys_context.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/tss2-esys/esys_context.c b/src/tss2-esys/esys_context.c
|
|
index b912a688..150a3495 100644
|
|
--- a/src/tss2-esys/esys_context.c
|
|
+++ b/src/tss2-esys/esys_context.c
|
|
@@ -54,15 +54,15 @@ Esys_Initialize(ESYS_CONTEXT ** esys_context, TSS2_TCTI_CONTEXT * tcti,
|
|
*esys_context = calloc(1, sizeof(ESYS_CONTEXT));
|
|
return_if_null(*esys_context, "Out of memory.", TSS2_ESYS_RC_MEMORY);
|
|
|
|
+ /* Store the application provided tcti to be return on Esys_GetTcti(). */
|
|
+ (*esys_context)->tcti_app_param = tcti;
|
|
+
|
|
/* Allocate memory for the SYS context */
|
|
syssize = Tss2_Sys_GetContextSize(0);
|
|
(*esys_context)->sys = calloc(1, syssize);
|
|
goto_if_null((*esys_context)->sys, "Error: During malloc.",
|
|
TSS2_ESYS_RC_MEMORY, cleanup_return);
|
|
|
|
- /* Store the application provided tcti to be return on Esys_GetTcti(). */
|
|
- (*esys_context)->tcti_app_param = tcti;
|
|
-
|
|
/* If no tcti was provided, initialize the default one. */
|
|
if (tcti == NULL) {
|
|
r = Tss2_TctiLdr_Initialize (NULL, &tcti);
|
|
--
|
|
2.41.0
|
|
|