Skip to content

Commit

Permalink
Fixed some potential segfault with wine apps (maybe others too)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Dec 1, 2023
1 parent ca1f0d0 commit e02844f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,8 @@ EXPORT int32_t my_open(x86emu_t* emu, void* pathname, int32_t flags, uint32_t mo
int dummy = write(tmp, emu->context->fullpath, strlen(emu->context->fullpath)+1);
(void)dummy;
for (int i=1; i<emu->context->argc; ++i)
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
if(emu->context->argv[i])
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
lseek(tmp, 0, SEEK_SET);
#endif
return tmp;
Expand Down Expand Up @@ -1862,7 +1863,8 @@ EXPORT int32_t my_open64(x86emu_t* emu, void* pathname, int32_t flags, uint32_t
int dummy = write(tmp, emu->context->fullpath, strlen(emu->context->fullpath)+1);
(void)dummy;
for (int i=1; i<emu->context->argc; ++i)
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
if(emu->context->argv[i]) //can be NULL when wine re-adjust the args
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
lseek(tmp, 0, SEEK_SET);
#endif
return tmp;
Expand Down

0 comments on commit e02844f

Please sign in to comment.