Fix coverity issue accepted/tizen/unified/20250310.131221 accepted/tizen/unified/x/20250311.125551
authorWoongsuk <ws77.cho@samsung.com>
Mon, 10 Mar 2025 00:24:47 +0000 (09:24 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Mon, 10 Mar 2025 00:31:26 +0000 (09:31 +0900)
add null check before creating string

NativeLauncher/launcher/exec/corerun.cc

index 887912bd4d4aa0be7c91b8354bcb17fea58d8c84..9b7f1d7fc52c390b6ad563959769000b52b098bc 100644 (file)
@@ -136,9 +136,11 @@ int main(int argc, const char* argv[]) {
                        }
 
                        // Implicit compatibility mode for System.CommandLine.
-                       std::string termValue(getenv("TERM"));
-                       if (termValue == "linux") {
-                               setenv("TERM", "xterm", 1);
+                       char* termValue = getenv("TERM");
+                       if (termValue) {
+                               if (strcmp(termValue, "linux") == 0) {
+                                       setenv("TERM", "xterm", 1);
+                               }
                        }
 
                        argc--;