this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

libelfloader: Give the ELF world the HOME env var it knows and expects

+16 -1
+16 -1
src/libelfloader/loader.c
··· 82 82 } 83 83 #endif 84 84 85 + static unsigned long processEnvVariable(const char* var) 86 + { 87 + if (strncmp(var, "HOME=/Users/", 12) == 0) 88 + { 89 + const size_t len = strlen(var); 90 + char* home = malloc(len); // 1 byte shorter 91 + 92 + strcpy(home, "HOME=/home/"); 93 + strcpy(home + 11, var+12); 94 + 95 + return (unsigned long) home; 96 + } 97 + return (unsigned long) var; 98 + } 99 + 85 100 void run(const char* path, const char** envp) 86 101 { 87 102 struct loader_context lc; ··· 131 146 132 147 133 148 for (int i = 0; envp[i] != NULL; i++) 134 - stack[pos++] = (unsigned long) envp[i]; 149 + stack[pos++] = processEnvVariable(envp[i]); 135 150 136 151 #ifdef __linux__ // For testing 137 152 getrandom(entropy, sizeof(entropy), 0);