Merge commit from fork

If `--addr-pool=1.2.3.4`, the runtime will return an error.
The value must be in the form of ADDRESS/MASK.
This commit is contained in:
liang.he
2025-07-27 14:38:56 +08:00
committed by GitHub
parent c080aa80d0
commit 121232a995
4 changed files with 13 additions and 3 deletions

View File

@ -3810,7 +3810,15 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
address = strtok(cp, "/");
mask = strtok(NULL, "/");
ret = addr_pool_insert(apool, address, (uint8)(mask ? atoi(mask) : 0));
if (!mask) {
snprintf(error_buf, error_buf_size,
"Invalid address pool entry: %s, must be in the format of "
"ADDRESS/MASK",
addr_pool[i]);
goto fail;
}
ret = addr_pool_insert(apool, address, (uint8)atoi(mask));
wasm_runtime_free(cp);
if (!ret) {
set_error_buf(error_buf, error_buf_size,