From ef9ba1a5a573741e6268bcf6cb2e842ed48976b5 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Mon, 23 Oct 2017 23:35:38 +0200 Subject: [PATCH] Block crappy "._" files from getting recognized as filetype --- source/filesys/filetype.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/filesys/filetype.c b/source/filesys/filetype.c index edb15c3..df4c823 100644 --- a/source/filesys/filetype.c +++ b/source/filesys/filetype.c @@ -18,10 +18,15 @@ u64 IdentifyFileType(const char* path) { char* fname = strrchr(path, '/'); char* ext = (fname) ? strrchr(++fname, '.') : NULL; u32 id = 0; + + + // block crappy "._" files from getting recognized as filetype + if (strncmp(fname, "._", 2)) return 0; + if (ext) ext++; if (FileGetData(path, header, 0x200, 0) < min(0x200, fsize)) return 0; - if (!fsize) return 0; + if (fsize >= 0x200) { if (ValidateNandNcsdHeader((NandNcsdHeader*) data) == 0) { return (fsize >= GetNandNcsdMinSizeSectors((NandNcsdHeader*) data) * 0x200) ?