Merge branch 'bugfix/spiffs_readdir_truntate_snprintf' into 'master'

spiffs: fix format-truncation warning

See merge request espressif/esp-idf!17240
pull/8526/head
Anton Maklakov 2022-03-10 14:57:52 +08:00
commit 101af84d77
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -667,7 +667,8 @@ static int vfs_spiffs_readdir_r(void* ctx, DIR* pdir, struct dirent* entry,
}
entry->d_ino = 0;
entry->d_type = out.type;
snprintf(entry->d_name, SPIFFS_OBJ_NAME_LEN, "%s", item_name);
strncpy(entry->d_name, item_name, SPIFFS_OBJ_NAME_LEN);
entry->d_name[SPIFFS_OBJ_NAME_LEN - 1] = '\0';
dir->offset++;
*out_dirent = entry;
return 0;