From 85a871c1d226956df7c1308a1e5527556fe35fe1 Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Sun, 16 Dec 2018 23:36:36 +0100 Subject: [PATCH] Hide files not ending with .conf from list in Windows UI --- installer/ChangeLog.txt | 1 + tunsafe_win32.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/installer/ChangeLog.txt b/installer/ChangeLog.txt index 916bf4e..ff8db98 100644 --- a/installer/ChangeLog.txt +++ b/installer/ChangeLog.txt @@ -23,6 +23,7 @@ Changes: look totally random. It can also be set to tls-chrome or tls-firefox to make the traffic look like HTTPS traffic. 10.Display incoming invalid packets in Windows UI +11.Hide files not ending with .conf from list in Windows UI 2018-10-21 - TunSafe v1.5-rc1 diff --git a/tunsafe_win32.cpp b/tunsafe_win32.cpp index 21928ba..463d1f7 100644 --- a/tunsafe_win32.cpp +++ b/tunsafe_win32.cpp @@ -444,6 +444,11 @@ void ConfigMenuBuilder::Recurse() { size_t len = strlen(wfd_.cFileName); if (bufpos_ + len >= sizeof(buf_) - 1) continue; + + // Ensure it ends with .conf + if (!(wfd_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (len < 5 || _strnicmp(&wfd_.cFileName[len - 5], ".conf", 5) != 0)) + continue; + size_t old_bufpos = bufpos_; memcpy(buf_ + bufpos_, wfd_.cFileName, len + 1); bufpos_ = bufpos_ + len + 1;