FIX: Don't show garbage in password input dialog (patch by vitaliyg)

This commit is contained in:
Alexander Koblov 2011-12-04 12:20:07 +00:00
commit 98eb4ad19f

View file

@ -218,17 +218,14 @@ begin
end;
function ShowPasswordDialog(out Password: AnsiString): Boolean;
var
pcTemp: PAnsiChar;
begin
Result:= False;
GetMem(pcTemp, MAX_PATH);
if RequestProc(PluginNumber, RT_Password, nil, nil, pcTemp, MAX_PATH) then
begin
Password:= pcTemp;
Result:= True;
end;
FreeMem(pcTemp);
SetLength(Password, MAX_PATH);
Password[1] := #0;
Result := RequestProc(PluginNumber, RT_Password, nil, nil, PChar(Password), MAX_PATH);
if Result then
Password:= PChar(Password) // truncate to #0
else
Password := '';
end;
function FtpConnect(const ConnectionName: AnsiString; out FtpSend: TFTPSendEx): Boolean;