Skip to content

Commit

Permalink
toolbox: Make Toolbox get_file_from_index count the same way as onLis…
Browse files Browse the repository at this point in the history
…tFiles
  • Loading branch information
nielsmh authored and erichelgeson committed May 10, 2024
1 parent 029787a commit b610955
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/BlueSCSI_Toolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,11 @@ FsFile get_file_from_index(uint8_t index, const char * dir_name)
file_test.close();
break;
}
file_test.getName(name, MAX_FILE_PATH);

// truncate filename the same way listing does, before validating name
size_t len = file_test.getName(name, MAX_FILE_PATH);
if (len > MAX_MAC_PATH)
name[MAX_MAC_PATH] = 0x0;
if(!toolboxFilenameValid(name))
{
file_test.close();
Expand Down

0 comments on commit b610955

Please sign in to comment.