mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 08:00:01 +02:00
LazUtils: Prevent CopyDirTree copying to a subdirectory of source. Issue #28841.
git-svn-id: trunk@51033 -
This commit is contained in:
parent
81733b2e74
commit
6faa4e893c
@ -704,8 +704,11 @@ begin
|
|||||||
Flags:=Flags+[cffCreateDestDirectory];
|
Flags:=Flags+[cffCreateDestDirectory];
|
||||||
Searcher.FFlags:=Flags;
|
Searcher.FFlags:=Flags;
|
||||||
Searcher.FCopyFailedCount:=0;
|
Searcher.FCopyFailedCount:=0;
|
||||||
Searcher.FSourceDir:=SetDirSeparators(SourceDir);
|
Searcher.FSourceDir:=TrimFilename(SetDirSeparators(SourceDir));
|
||||||
Searcher.FTargetDir:=SetDirSeparators(TargetDir);
|
Searcher.FTargetDir:=TrimFilename(SetDirSeparators(TargetDir));
|
||||||
|
// Don't even try to copy to a subdirectory of SourceDir.
|
||||||
|
if {$if defined(Windows) or defined(darwin)}AnsiStartsText{$ELSE}AnsiStartsStr{$ENDIF}
|
||||||
|
(SourceDir, TargetDir) then Exit;
|
||||||
Searcher.Search(SourceDir);
|
Searcher.Search(SourceDir);
|
||||||
Result:=True;
|
Result:=True;
|
||||||
finally
|
finally
|
||||||
|
@ -32,7 +32,7 @@ unit FileUtil;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils, strutils,
|
||||||
Masks, LazUTF8, LazFileUtils;
|
Masks, LazUTF8, LazFileUtils;
|
||||||
|
|
||||||
{$if defined(Windows) or defined(darwin)}
|
{$if defined(Windows) or defined(darwin)}
|
||||||
|
Loading…
Reference in New Issue
Block a user