🚨 Clamp write permission areas to the landscape size
The write map trusted area coordinates from the login response and could index a bits array far out of bounds with hostile data.
This commit is contained in:
@@ -1327,6 +1327,10 @@ begin
|
|||||||
y1 := AStream.ReadWord;
|
y1 := AStream.ReadWord;
|
||||||
x2 := AStream.ReadWord;
|
x2 := AStream.ReadWord;
|
||||||
y2 := AStream.ReadWord;
|
y2 := AStream.ReadWord;
|
||||||
|
if (x1 >= FCellWidth) or (y1 >= FCellHeight) then
|
||||||
|
Continue;
|
||||||
|
if x2 >= FCellWidth then x2 := FCellWidth - 1;
|
||||||
|
if y2 >= FCellHeight then y2 := FCellHeight - 1;
|
||||||
for cellX := x1 to x2 do
|
for cellX := x1 to x2 do
|
||||||
for cellY := y1 to y2 do
|
for cellY := y1 to y2 do
|
||||||
FWriteMap[cellX * FCellHeight + cellY] := True;
|
FWriteMap[cellX * FCellHeight + cellY] := True;
|
||||||
|
|||||||
Reference in New Issue
Block a user