FatFsUtil: Skip past entries with invalid filenames.

This commit is contained in:
Admiral H. Curtiss 2022-06-26 02:08:58 +02:00
parent de9c9f2281
commit 2d8d3358c4
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 7 additions and 0 deletions

View File

@ -615,6 +615,13 @@ static bool Unpack(const std::string path, bool is_directory, const char* name,
if (entry.fname[0] == '\0')
break;
if (entry.fname[0] == '?' && entry.fname[1] == '\0' && entry.altname[0] == '\0')
{
// FATFS indicates entries that have neither a short nor a long filename this way.
// These are likely corrupted file entries so just skip them.
continue;
}
const std::string_view childname = entry.fname;
// Check for path traversal attacks.