From 1b12011507ec208a5002ea35d3af711c1cd33516 Mon Sep 17 00:00:00 2001 From: Chad Attermann Date: Mon, 15 Jul 2024 09:01:40 -0600 Subject: [PATCH] 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. --- libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp b/libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp index 4f8d48567..f5fe86a72 100644 --- a/libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp +++ b/libraries/Adafruit_LittleFS/src/Adafruit_LittleFS_File.cpp @@ -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;