summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FatFsUtil.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-06-26 02:08:58 +0200
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-07-11 23:11:42 +0200
commit2d8d3358c4b86032263afe0d5d9b27c53e097cd2 (patch)
tree15a14959e925e4fb88b9194ba7a68ff7d24af912 /Source/Core/Common/FatFsUtil.cpp
parentde9c9f22814fdd86478e307877087ecdaa15185c (diff)
FatFsUtil: Skip past entries with invalid filenames.
Diffstat (limited to 'Source/Core/Common/FatFsUtil.cpp')
-rw-r--r--Source/Core/Common/FatFsUtil.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp
index 0176178b3a..f247ae3f73 100644
--- a/Source/Core/Common/FatFsUtil.cpp
+++ b/Source/Core/Common/FatFsUtil.cpp
@@ -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.