mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
esp_vfs_unregister_with_id() scanned only the first VFS_MAX_COUNT (default 8, max 20) slots of s_fd_table[MAX_FDS] (MAX_FDS = FD_SETSIZE, 64 on non-Cygwin targets) when clearing stale references to the unregistered VFS. Every other loop over s_fd_table in this file (and in vfs_calls.c) correctly bounds on MAX_FDS. Any global fd >= VFS_MAX_COUNT that was still open against the VFS being unregistered was left with a stale vfs_index pointing at a slot that esp_get_free_index() can immediately hand out to the next esp_vfs_register*() call, causing later operations on that fd to be routed into an unrelated filesystem's context. Signed-off-by: yi chen <94xhn1@gmail.com>