diff options
| author | ValdikSS <iam@valdikss.org.ru> | 2025-01-06 10:42:08 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-06 08:42:08 +0100 |
| commit | 6f46ccdd5ab5c0df527584d7411d9724909cc1ec (patch) | |
| tree | be79a7ad67d75807c7c02da844275453e20b0515 /src | |
| parent | b79ba11d95bdfdbcaa3edd636aec86a49c2113fc (diff) | |
| download | box64-6f46ccdd5ab5c0df527584d7411d9724909cc1ec.tar.gz box64-6f46ccdd5ab5c0df527584d7411d9724909cc1ec.zip | |
Fix crash with incorrect argv[0]: rewrite it only if "box64" is present (#2233)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c index 253b7dc9..a39fa795 100644 --- a/src/core.c +++ b/src/core.c @@ -2142,9 +2142,14 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf { my_context->box86path = box_strdup(my_context->box64path); #ifndef BOX32 - char* p = strrchr(my_context->box86path, '6'); // get the 6 of box64 - p[0] = '8'; p[1] = '6'; // change 64 to 86 - if(!FileExist(my_context->box86path, IS_FILE)) { + if(strstr(my_context->box86path, "box64")) { + char* p = strrchr(my_context->box86path, '6'); // get the 6 of box64 + p[0] = '8'; p[1] = '6'; // change 64 to 86 + } else { + box_free(my_context->box86path); + my_context->box86path = ResolveFileSoft("box86", &my_context->box64_path); + } + if(my_context->box86path && !FileExist(my_context->box86path, IS_FILE)) { box_free(my_context->box86path); my_context->box86path = NULL; } |