Skip to content

Commit

Permalink
Null termination of file name when max length
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
attermann committed Jul 15, 2024
1 parent 8c8bcf2 commit 1b12011
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ File::File (Adafruit_LittleFS &fs)
_fs = &fs;
_is_dir = false;
_name[0] = 0;
_name[LFS_NAME_MAX] = 0;
_dir_path = NULL;

_dir = NULL;
Expand Down

0 comments on commit 1b12011

Please sign in to comment.