mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 18:29:12 +02:00
win32: fix range check error in open/save dialogs code (#0012336)
git-svn-id: trunk@16954 -
This commit is contained in:
parent
e5de689ab4
commit
3c20093934
@ -11,7 +11,7 @@
|
|||||||
* *
|
* *
|
||||||
* This file is part of the Lazarus Component Library (LCL) *
|
* This file is part of the Lazarus Component Library (LCL) *
|
||||||
* *
|
* *
|
||||||
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
* See the file COPYING.modifiedLGPL.txt, included in this distribution, *
|
||||||
* for details about the copyright. *
|
* for details about the copyright. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
@ -174,7 +174,7 @@ var
|
|||||||
|
|
||||||
procedure SetFilesPropertyCustomFiles(AFiles:TStrings);
|
procedure SetFilesPropertyCustomFiles(AFiles:TStrings);
|
||||||
var
|
var
|
||||||
i, Start: integer;
|
i, Start, len: integer;
|
||||||
FolderName: string;
|
FolderName: string;
|
||||||
FileNames: String;
|
FileNames: String;
|
||||||
begin
|
begin
|
||||||
@ -194,17 +194,18 @@ var
|
|||||||
FileNames := DialogRec^.AnsiFileNames;
|
FileNames := DialogRec^.AnsiFileNames;
|
||||||
{$endif}
|
{$endif}
|
||||||
FolderName := AppendPathDelim(FolderName);
|
FolderName := AppendPathDelim(FolderName);
|
||||||
if (Length(FileNames) > 0) and (FileNames[1] = '"') then
|
len := Length(FileNames);
|
||||||
|
if (len > 0) and (FileNames[1] = '"') then
|
||||||
begin
|
begin
|
||||||
Start := 1; // first quote is on pos 1
|
Start := 1; // first quote is on pos 1
|
||||||
while FileNames[Start] <> #0 do
|
while (start <= len) and (FileNames[Start] <> #0) do
|
||||||
begin
|
begin
|
||||||
i := Start + 1;
|
i := Start + 1;
|
||||||
while FileNames[i] <> '"' do
|
while FileNames[i] <> '"' do
|
||||||
inc(i);
|
inc(i);
|
||||||
AFiles.Add(FolderName + Copy(FileNames, Start + 1, I - Start - 1));
|
AFiles.Add(FolderName + Copy(FileNames, Start + 1, I - Start - 1));
|
||||||
start := i+1;
|
start := i+1;
|
||||||
while (FileNames[Start] <> #0) and (FileNames[start] <> '"') do
|
while (start <= len) and (FileNames[Start] <> #0) and (FileNames[start] <> '"') do
|
||||||
inc(Start);
|
inc(Start);
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user