Browse Source

Bug 1675: Prevent SCP server sending files that were not requested

https://winscp.net/tracker/1675
(cherry picked from commit 49d876f2c5fc00bcedaa986a7cf6dedd6bf16f54)

# Conflicts:
#	source/resource/TextsCore.h
#	source/resource/TextsCore1.rc

Source commit: 4752be9c185028074ad63f21a113c60c9495dd6f
Martin Prikryl 7 years ago
parent
commit
f8f9a00ce1
1 changed files with 4 additions and 0 deletions
  1. 4 0
      source/core/ScpFileSystem.cpp

+ 4 - 0
source/core/ScpFileSystem.cpp

@@ -2374,6 +2374,10 @@ void __fastcall TSCPFileSystem::SCPSink(const UnicodeString TargetDir,
           {
             FTerminal->LogEvent(FORMAT(L"Warning: Remote host set a compound pathname '%s'", (Line)));
           }
+          if ((Level == 0) && (OnlyFileName != UnixExtractFileName(FileName)))
+          {
+            SCPError(L"Server sent a file that was not requested.", False);
+          }
 
           FullFileName = SourceDir + OnlyFileName;
           OperationProgress->SetFile(FullFileName);