Fix lsDive filename stack overrun (PR#2449)
This commit is contained in:
parent
ee71845d60
commit
552a327df8
1 changed files with 2 additions and 2 deletions
|
@ -56,8 +56,8 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
|
||||||
// If the entry is a directory and the action is LS_SerialPrint
|
// If the entry is a directory and the action is LS_SerialPrint
|
||||||
if (DIR_IS_SUBDIR(&p) && lsAction != LS_Count && lsAction != LS_GetFilename) {
|
if (DIR_IS_SUBDIR(&p) && lsAction != LS_Count && lsAction != LS_GetFilename) {
|
||||||
|
|
||||||
// Allocate enough stack space for the full path to a folder
|
// Allocate enough stack space for the full path to a folder, trailing slash, and nul
|
||||||
int len = strlen(prepend) + FILENAME_LENGTH + 1;
|
int len = strlen(prepend) + FILENAME_LENGTH + 1 + 1;
|
||||||
char path[len];
|
char path[len];
|
||||||
|
|
||||||
// Get the short name for the item, which we know is a folder
|
// Get the short name for the item, which we know is a folder
|
||||||
|
|
Reference in a new issue