8000 Null termination of file name when max length · adafruit/Adafruit_nRF52_Arduino@1b12011 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b12011

Browse files
committed
Null termination of file name when max length
File names are returned unterminated in the edge case where their length is max size This is due to the fact that strncpy does terminate the destination string when the source string is greater than or equal to the specifid maximum length.
1 parent 8c8bcf2 commit 1b12011

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ File::File (Adafruit_LittleFS &fs)
3737
_fs = &fs;
3838
_is_dir = false;
3939
_name[0] = 0;
40+
_name[LFS_NAME_MAX] = 0;
4041
_dir_path = NULL;
4142

4243
_dir = NULL;

0 commit comments

Comments
 (0)
0