Skip to content

Commit

Permalink
Fix crash with incorrect argv[0]: rewrite it only if "box86" is prese…
Browse files Browse the repository at this point in the history
…nt (#1020)
  • Loading branch information
ValdikSS authored Jan 4, 2025
1 parent efe8bb4 commit d940221
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,10 @@ int main(int argc, const char **argv, char **env)
my_context->box64path = getenv("BOX86_BOX64");
if(!my_context->box64path) {
my_context->box64path = box_strdup(my_context->box86path);
char* p = strrchr(my_context->box64path, '8'); // get the 8 of box86
p[0] = '6'; p[1] = '4'; // change 86 to 64
if (strstr(my_context->box64path, "box86")) {
char* p = strrchr(my_context->box64path, '8'); // get the 8 of box86
p[0] = '6'; p[1] = '4'; // change 86 to 64
}
}
if(!FileExist(my_context->box64path, IS_FILE)) {
box_free(my_context->box64path);
Expand Down

0 comments on commit d940221

Please sign in to comment.