From f4a7a88167b691be5c9a6ed7f8859fb32d9cf9ec Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 1 Dec 2023 17:41:41 +0100 Subject: Fixed some potentials segfault with wine apps (maybe other too) --- src/wrapped/wrappedlibc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index b0e7dbd8..1d3fb9e9 100644 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -1615,7 +1615,8 @@ EXPORT int32_t my_open(x64emu_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; icontext->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; @@ -1692,7 +1693,8 @@ EXPORT int32_t my_open64(x64emu_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; icontext->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; -- cgit 1.4.1