mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 22:07:56 +02:00
Improve token buffer size checks.
* For settings comparison: call CompareByte only on copy_size. * For mesgnb: verify that there is enough memory space in rest of tokenbuf to hold the number of messages. + Add a check that tbi is not greater than tokenbufsize.
This commit is contained in:
parent
2ed2ca5cf0
commit
98ef2773e0
@ -2709,7 +2709,7 @@ begin
|
||||
stbi:=tbi;
|
||||
tokenreadsettings(new_settings, copy_size);
|
||||
tbi:=stbi+copy_size;
|
||||
if CompareByte(new_settings,prev_settings,sizeof(new_settings))<>0 then
|
||||
if CompareByte(new_settings,prev_settings,copy_size)<>0 then
|
||||
begin
|
||||
dump_new_settings;
|
||||
writeln;
|
||||
@ -2725,6 +2725,10 @@ begin
|
||||
inc(tbi);
|
||||
mesgnb:=gettokenbufsizeint;;
|
||||
writeln([space,mesgnb,' messages: ']);
|
||||
if (tbi+2*sizeof(longint)*mesgnb>tokenbufsize) then
|
||||
begin
|
||||
WriteError('!! Error: number of messages incompatible with token buffer size');
|
||||
end;
|
||||
for nb:=1 to mesgnb do
|
||||
begin
|
||||
msgvalue:=gettokenbuflongint;
|
||||
@ -2774,7 +2778,12 @@ begin
|
||||
if tbi<tokenbufsize then
|
||||
write(',');
|
||||
end;
|
||||
writeln;
|
||||
if (tbi>tokenbufsize) then
|
||||
begin
|
||||
WriteError('!! Error: read past of token buffer size');
|
||||
end
|
||||
else
|
||||
writeln;
|
||||
StrAppend(genstr,linestr);
|
||||
writeln(['##',genstr,'##']);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user