From d16027ff9e1e97b2eaa960de8bc2d03df0ddc726 Mon Sep 17 00:00:00 2001 From: wenyongh Date: Fri, 22 Nov 2019 15:28:02 +0800 Subject: [PATCH] Update bh_platform.c Add check for function bh_vprintf_sgx: check whether print_function is not NULL. --- core/shared-lib/platform/linux-sgx/bh_platform.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/shared-lib/platform/linux-sgx/bh_platform.c b/core/shared-lib/platform/linux-sgx/bh_platform.c index ef95e920b..7ca838f07 100644 --- a/core/shared-lib/platform/linux-sgx/bh_platform.c +++ b/core/shared-lib/platform/linux-sgx/bh_platform.c @@ -60,8 +60,11 @@ int bh_printf_sgx(const char *message, ...) int bh_vprintf_sgx(const char * format, va_list arg) { - char msg[FIXED_BUFFER_SIZE] = { '\0' }; - vsnprintf(msg, FIXED_BUFFER_SIZE, format, arg); - print_function(msg); + if (print_function != NULL) { + char msg[FIXED_BUFFER_SIZE] = { '\0' }; + vsnprintf(msg, FIXED_BUFFER_SIZE, format, arg); + print_function(msg); + } + return 0; }