Skip to content
Closed
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
6 changes: 6 additions & 0 deletions deps/uvwasi/src/fd_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ uvwasi_errno_t uvwasi_fd_table_insert(uvwasi_t* uvwasi,
if (type != UVWASI_FILETYPE_SOCKET_STREAM) {
mp_len = strlen(mapped_path);
rp_len = strlen(real_path);
/* Validate path lengths to prevent integer overflow in the allocation
size calculation below and to bound the memcpy operations. WASI paths
are limited to 65535 bytes, which is far beyond any practical path
length and safely avoids overflow in: mp_len + mp_len + rp_len + 3. */
if (mp_len > 65535 || rp_len > 65535)
return UVWASI_ENAMETOOLONG;
} else {
mp_len = 0;
rp_len = 0;
Expand Down
Loading