🚨 Validate radar map packet payloads
An empty radar map indexed an empty array, and update coordinates from the server were written into the image without bounds checks.
This commit is contained in:
@@ -217,6 +217,7 @@ begin
|
||||
$02: //radar map
|
||||
begin
|
||||
SetLength(radarMap, (ABuffer.Size - ABuffer.Position) div SizeOf(Word));
|
||||
if Length(radarMap) > 0 then
|
||||
ABuffer.Read(radarMap[0], Length(radarMap) * SizeOf(Word));
|
||||
RefreshRadar(radarMap);
|
||||
//frmMain.Enabled := True;
|
||||
@@ -227,10 +228,13 @@ begin
|
||||
begin
|
||||
x := ABuffer.ReadWord;
|
||||
y := ABuffer.ReadWord;
|
||||
if (x < FRadar.Width) and (y < FRadar.Height) then
|
||||
begin
|
||||
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
|
||||
RepaintRadar;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRadarMap.RefreshRadar(ARadarMap: TRadarColorMap);
|
||||
|
||||
Reference in New Issue
Block a user