Need to zero homeIsaDir before use
authorKonstantinos Margaritis <konstantinos.margaritis@vectorcamp.gr>
Thu, 14 Sep 2023 11:54:51 +0000 (11:54 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Dec 2023 19:26:20 +0000 (19:26 +0000)
media/pypowersim_wrapper/pypowersim_wrapper_common.h

index 0eaa861c9c6112676869ffa2f7ab850a91c7610d..848809f5773390bd7f133ae74221ca1289dc5b23 100644 (file)
@@ -42,11 +42,11 @@ static pypowersim_state_t *pypowersim_prepare(void) {
       Py_Initialize();
 
       // To construct directory based on username, need $HOME
-      char homeIsaDir[100];
+      char homeIsaDir[100] = {0};
       const char *homeDir = getenv("HOME"); // user specific - /home/[USER NAME]
       strcat(homeIsaDir, homeDir);
       strcat(homeIsaDir, "/src/openpower-isa/src/openpower/decoder/isa/");
-      printf(homeIsaDir);
+      printf("homeIsaDir: %s\n", homeIsaDir);
 
       PyObject* sysPath = PySys_GetObject((char*)"path");
       PyObject* curDir = PyUnicode_FromString(homeIsaDir);