forked from espressif/esp-idf
vfs, fatfs: fix support for two FATFS instances (SD and flash)
- fix null pointer dereference in VFS when VFS implementations are added and removed in different order - vfs_fat_sdmmc, vfs_fat_spiflash: pass correct drive to mkfs (previously it would always do mkfs in the first drive) - add test case
This commit is contained in:
@@ -125,6 +125,9 @@ static const vfs_entry_t* get_vfs_for_path(const char* path)
|
||||
size_t len = strlen(path);
|
||||
for (size_t i = 0; i < s_vfs_count; ++i) {
|
||||
const vfs_entry_t* vfs = s_vfs[i];
|
||||
if (!vfs) {
|
||||
continue;
|
||||
}
|
||||
if (len < vfs->path_prefix_len + 1) { // +1 is for the trailing slash after base path
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user