From 4d1949e6d76a4fa7a2f2653953961369133bbeb5 Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Tue, 29 Jun 2021 08:05:37 +0900 Subject: [PATCH] Expand array size for null terminate character To avoid svace defect, expand array size. And copy string include null terminate character --- NativeLauncher/launcher/lib/core_runtime.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NativeLauncher/launcher/lib/core_runtime.cc b/NativeLauncher/launcher/lib/core_runtime.cc index b500b01..64cee32 100644 --- a/NativeLauncher/launcher/lib/core_runtime.cc +++ b/NativeLauncher/launcher/lib/core_runtime.cc @@ -538,8 +538,8 @@ int CoreRuntime::launch(const char* appId, const char* root, const char* path, i // set profile.data path and collect/use it if it non-exists/exists. if (profile) { - char multiCoreJitProfile[strlen(localDataPath) + strlen(PROFILE_BASENAME)]; - strncpy(multiCoreJitProfile, localDataPath, strlen(localDataPath)); + char multiCoreJitProfile[strlen(localDataPath) + strlen(PROFILE_BASENAME) + 1]; + strncpy(multiCoreJitProfile, localDataPath, strlen(localDataPath) + 1); strncat(multiCoreJitProfile, PROFILE_BASENAME, strlen(PROFILE_BASENAME)); setEnvironmentVariable("COMPlus_MultiCoreJitProfile", multiCoreJitProfile); -- 2.7.4