From 649901e579160d0f0f8c089a662e1a13aae5de33 Mon Sep 17 00:00:00 2001 From: Yi LIU Date: Wed, 25 Feb 2026 23:06:51 +0800 Subject: [PATCH] Fix sock_connect using wrong rights constant wasi_ssp_sock_connect checks __WASI_RIGHT_SOCK_BIND instead of __WASI_RIGHT_SOCK_CONNECT when validating file descriptor rights. This was a copy-paste error from wasi_ssp_sock_bind. As a result, connect operations check the wrong capability. --- .../libraries/libc-wasi/sandboxed-system-primitives/src/posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4987a9d833..d0e3eb6915 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 @@ -2585,7 +2585,7 @@ wasi_ssp_sock_connect(wasm_exec_env_t exec_env, struct fd_table *curfds, return __WASI_EACCES; } - error = fd_object_get(curfds, &fo, fd, __WASI_RIGHT_SOCK_BIND, 0); + error = fd_object_get(curfds, &fo, fd, __WASI_RIGHT_SOCK_CONNECT, 0); if (error != __WASI_ESUCCESS) { return error; }