From e8c48161b552a3842d516755f520c1bb8fa1eb47 Mon Sep 17 00:00:00 2001 From: Tianjia Zhang Date: Thu, 4 Jun 2020 16:50:01 +0800 Subject: [PATCH] pal: Fix typo error in saving token file The address of the `token` should be used by fwrite(). Signed-off-by: Tianjia Zhang --- src/pal/src/pal_enclave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pal/src/pal_enclave.c b/src/pal/src/pal_enclave.c index 48e08ffc..becea3db 100644 --- a/src/pal/src/pal_enclave.c +++ b/src/pal/src/pal_enclave.c @@ -117,7 +117,7 @@ int pal_init_enclave(const char *instance_dir) { /* reopen the file with write capablity */ fp = freopen(token_path, "wb", fp); if (fp == NULL) { return 0; } - size_t write_num = fwrite(token, 1, sizeof(sgx_launch_token_t), fp); + size_t write_num = fwrite(&token, 1, sizeof(sgx_launch_token_t), fp); if (write_num != sizeof(sgx_launch_token_t)) { PAL_WARN("Warning: Failed to save launch token to \"%s\".\n", token_path); }