Hide files not ending with .conf from list in Windows UI

This commit is contained in:
Ludvig Strigeus 2018-12-16 23:36:36 +01:00
parent 671205e1de
commit 85a871c1d2
2 changed files with 6 additions and 0 deletions

View file

@ -23,6 +23,7 @@ Changes:
look totally random. It can also be set to tls-chrome or tls-firefox look totally random. It can also be set to tls-chrome or tls-firefox
to make the traffic look like HTTPS traffic. to make the traffic look like HTTPS traffic.
10.Display incoming invalid packets in Windows UI 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 2018-10-21 - TunSafe v1.5-rc1

View file

@ -444,6 +444,11 @@ void ConfigMenuBuilder::Recurse() {
size_t len = strlen(wfd_.cFileName); size_t len = strlen(wfd_.cFileName);
if (bufpos_ + len >= sizeof(buf_) - 1) if (bufpos_ + len >= sizeof(buf_) - 1)
continue; 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_; size_t old_bufpos = bufpos_;
memcpy(buf_ + bufpos_, wfd_.cFileName, len + 1); memcpy(buf_ + bufpos_, wfd_.cFileName, len + 1);
bufpos_ = bufpos_ + len + 1; bufpos_ = bufpos_ + len + 1;