mirror of
https://github.com/pellepl/spiffs.git
synced 2026-09-22 17:07:34 +00:00
Merge pull request #307 from 94xhn/fix-spiffs-stat-nul-termination
Fix non-NUL-terminated name in spiffs_stat_pix()
This commit is contained in:
@@ -783,7 +783,8 @@ static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spi
|
||||
s->type = objix_hdr.type;
|
||||
s->size = objix_hdr.size == SPIFFS_UNDEFINED_LEN ? 0 : objix_hdr.size;
|
||||
s->pix = pix;
|
||||
strncpy((char *)s->name, (char *)objix_hdr.name, SPIFFS_OBJ_NAME_LEN);
|
||||
strncpy((char *)s->name, (char *)objix_hdr.name, sizeof(s->name) - 1);
|
||||
s->name[sizeof(s->name) - 1] = '\0';
|
||||
#if SPIFFS_OBJ_META_LEN
|
||||
_SPIFFS_MEMCPY(s->meta, objix_hdr.meta, SPIFFS_OBJ_META_LEN);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user