diff --git a/core/iwasm/libraries/libc-uvwasi/libc_uvwasi_wrapper.c b/core/iwasm/libraries/libc-uvwasi/libc_uvwasi_wrapper.c index 5f2a5521..187693ea 100644 --- a/core/iwasm/libraries/libc-uvwasi/libc_uvwasi_wrapper.c +++ b/core/iwasm/libraries/libc-uvwasi/libc_uvwasi_wrapper.c @@ -186,6 +186,9 @@ wasi_environ_get(wasm_exec_env_t exec_env, uint32 *environ_offsets, if (err) return err; + if (environ_count == 0) + return 0; + total_size = sizeof(int32) * ((uint64)environ_count + 1); if (total_size >= UINT32_MAX || !validate_native_addr(environ_offsets, (uint32)total_size) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index 33d53101..cc618680 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -2595,7 +2595,7 @@ wasmtime_ssp_poll_oneoff( timeout = ts > INT_MAX ? -1 : (int)ts; } else { - timeout = -1; + timeout = 1000; } int ret = poll(pfds, nsubscriptions, timeout);