* fixed shortstring version of setstring

This commit is contained in:
Jonas Maebe 2003-02-26 20:04:47 +00:00
parent b5976b8730
commit eee67f89ea

View File

@ -671,24 +671,22 @@ end;
Procedure SetString (Var S : Shortstring; Buf : PChar; Len : Longint);
var
BufLen: Longint;
begin
S[0]:=chr(Len);
If Len > High(S) then
Len := High(S);
SetLength(S,Len);
If Buf<>Nil then
begin
BufLen := StrLen(Buf);
if BufLen < Len then
Len := BufLen;
Move (Buf[0],S[1],Len);
end;
end;
{
$Log$
Revision 1.26 2002-10-21 19:52:47 jonas
Revision 1.27 2003-02-26 20:04:47 jonas
* fixed shortstring version of setstring
Revision 1.26 2002/10/21 19:52:47 jonas
* fixed some buffer overflow errors in SetString (both short and
ansistring versions) (merged)