mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:39:25 +02:00
* fixed shortstring version of setstring
This commit is contained in:
parent
b5976b8730
commit
eee67f89ea
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user