瀏覽代碼

Fix sock_connect using wrong rights constant (#4849)

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.
Yi Liu 2 月之前
父節點
當前提交
6a504e5ade
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c

+ 1 - 1
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;
         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) {
     if (error != __WASI_ESUCCESS) {
         return error;
         return error;
     }
     }