bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.98k stars 628 forks source link

Fix WASI Path Mapping Processing #3923

Open dpjohnst opened 21 hours ago

dpjohnst commented 21 hours ago

Filesystem paths can be mapped from the host path to a guest path using the format <guest-path>::<host-path>.

Previously strtok was used to find the :: delimiter. Unfortunately strtok processes each delimiter character individually. This meant that the code was ~equivalent to strtok(mapping_copy, ":") which breaks with Windows-style paths (E.g. C:\my_path\).

To fix this strstr is used to search for the exact delimiter.