mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 06:49:13 +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);
|
Procedure SetString (Var S : Shortstring; Buf : PChar; Len : Longint);
|
||||||
var
|
|
||||||
BufLen: Longint;
|
|
||||||
begin
|
begin
|
||||||
S[0]:=chr(Len);
|
|
||||||
If Len > High(S) then
|
If Len > High(S) then
|
||||||
Len := High(S);
|
Len := High(S);
|
||||||
|
SetLength(S,Len);
|
||||||
If Buf<>Nil then
|
If Buf<>Nil then
|
||||||
begin
|
begin
|
||||||
BufLen := StrLen(Buf);
|
|
||||||
if BufLen < Len then
|
|
||||||
Len := BufLen;
|
|
||||||
Move (Buf[0],S[1],Len);
|
Move (Buf[0],S[1],Len);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* fixed some buffer overflow errors in SetString (both short and
|
||||||
ansistring versions) (merged)
|
ansistring versions) (merged)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user