use setenv in initNICommon() function
authorWoongsuk <ws77.cho@samsung.com>
Tue, 22 Apr 2025 01:54:49 +0000 (10:54 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 22 Apr 2025 02:19:40 +0000 (11:19 +0900)
In case of VD integration, The function initNICommon() is called by dlsym().
The string pointed by the putenv() in initNICommon() can be invalid
after calling dlclose().

To avoid sigsegv, change putenv to setenv.

NativeLauncher/tool/ni_common.cc

index 056892729586ac2326eb1362d58357cb5cd1f8d1..519b2b178fe687942e8b35f2b7e94ac08fa7c14b 100644 (file)
@@ -958,7 +958,7 @@ ni_error_e initNICommon()
        }
 
        // disable diagnostics when running crossgen
-       putenv(const_cast<char *>("COMPlus_EnableDiagnostics=0"));
+       setenv("COMPlus_EnableDiagnostics", "0", 1);
 
        if (initializePluginManager("normal")) {
                _SERR("Fail to initialize PluginManager");