From decd7375dafc290ada3fa2c09b1c91ae11c737b3 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 16 Nov 2024 22:37:36 +0000 Subject: [PATCH] Prevent wpa_supplicant.conf from being downloaded To be tested --- circle-stdlib | 2 +- src/net/ftpworker.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/circle-stdlib b/circle-stdlib index 3bd135d..db053a3 160000 --- a/circle-stdlib +++ b/circle-stdlib @@ -1 +1 @@ -Subproject commit 3bd135d35ac23c7c726924cb85b5890cbf80bbfe +Subproject commit db053a32c165c1b22423a47ed6cb5bddc72b51f2 diff --git a/src/net/ftpworker.cpp b/src/net/ftpworker.cpp index f7438ce..fb57254 100644 --- a/src/net/ftpworker.cpp +++ b/src/net/ftpworker.cpp @@ -617,6 +617,13 @@ bool CFTPWorker::Retrieve(const char* pArgs) FIL File; CString Path = RealPath(pArgs); + // If the filename is "wpa_supplicant.conf", don't allow it to be retrieved + if (strcmp(Path, "/wpa_supplicant.conf") == 0) + { + SendStatus(TFTPStatus::FileActionNotTaken, "File action not taken."); + return false; + } + if (f_open(&File, Path, FA_READ) != FR_OK) { SendStatus(TFTPStatus::FileActionNotTaken, "Could not open file for reading."); @@ -986,10 +993,10 @@ bool CFTPWorker::ListFileNames(const char* pArgs) const TDirectoryListEntry& Entry = pDirEntries[i]; if (Entry.Type == TDirectoryListEntryType::Directory) continue; - /*if (Entry.Name == "wpa_supplicant.conf") + if (strcmp(Entry.Name, "wpa_supplicant.conf") == 0) { continue; - }*/ + } const int nLength = snprintf(Buffer, sizeof(Buffer), "%s\r\n", Entry.Name); if (pDataSocket->Send(Buffer, nLength, 0) < 0) {