From 1bcc064593545ff3603521f24e7d32c8b8adabab Mon Sep 17 00:00:00 2001 From: Tillsunset <35825944+Tillsunset@users.noreply.github.com> Date: Sun, 23 Oct 2022 06:06:20 -0500 Subject: [PATCH] Add check for "." in FSC path (#402) --- src/Cafe/Filesystem/FST/fstUtil.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Cafe/Filesystem/FST/fstUtil.h b/src/Cafe/Filesystem/FST/fstUtil.h index 4ea9465d..01283684 100644 --- a/src/Cafe/Filesystem/FST/fstUtil.h +++ b/src/Cafe/Filesystem/FST/fstUtil.h @@ -28,6 +28,8 @@ class FSCPath { if (m_names.size() > 0xFFFF) return; + if (nameLen == 1 && *name == '.') + return; m_nodes.emplace_back((uint16)m_names.size(), nameLen); m_names.insert(m_names.end(), name, name + nameLen); } @@ -297,6 +299,12 @@ static void FSTPathUnitTest() cemu_assert_debug(p6.GetNodeCount() == 0); p6 = FSCPath("/////////////"); cemu_assert_debug(p6.GetNodeCount() == 0); + // test 7 - periods in path + FSCPath p7("/vol/content/./.."); + cemu_assert_debug(p7.GetNodeCount() == 3); + cemu_assert_debug(p7.MatchNodeName(0, "vol")); + cemu_assert_debug(p7.MatchNodeName(1, "content")); + cemu_assert_debug(p7.MatchNodeName(2, "..")); }