Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions core/iwasm/libraries/libc-wasi/libc_wasi_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,10 +2009,6 @@ allocate_iovec_app_buffer(wasm_module_inst_t module_inst,
uint32 i;
uint8 *buf_begin = NULL;

if (data_len == 0) {
return __WASI_EINVAL;
}

total_size = sizeof(iovec_app_t) * (uint64)data_len;
if (total_size >= UINT32_MAX
|| !validate_native_addr((void *)data, total_size))
Expand All @@ -2022,12 +2018,9 @@ allocate_iovec_app_buffer(wasm_module_inst_t module_inst,
total_size += data->buf_len;
}

if (total_size == 0) {
return __WASI_EINVAL;
}

if (total_size >= UINT32_MAX
|| !(buf_begin = wasm_runtime_malloc((uint32)total_size))) {
|| !(buf_begin =
wasm_runtime_malloc(total_size ? (uint32)total_size : 1))) {
return __WASI_ENOMEM;
}

Expand Down
Loading