🚨 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:
2026-11-15 22:08:32 +01:00
parent fcb90dffbb
commit f09b8b7fbc
+7 -3
View File
@@ -217,7 +217,8 @@ begin
$02: //radar map $02: //radar map
begin begin
SetLength(radarMap, (ABuffer.Size - ABuffer.Position) div SizeOf(Word)); SetLength(radarMap, (ABuffer.Size - ABuffer.Position) div SizeOf(Word));
ABuffer.Read(radarMap[0], Length(radarMap) * SizeOf(Word)); if Length(radarMap) > 0 then
ABuffer.Read(radarMap[0], Length(radarMap) * SizeOf(Word));
RefreshRadar(radarMap); RefreshRadar(radarMap);
//frmMain.Enabled := True; //frmMain.Enabled := True;
frmInitialize.UnsetModal; frmInitialize.UnsetModal;
@@ -227,8 +228,11 @@ begin
begin begin
x := ABuffer.ReadWord; x := ABuffer.ReadWord;
y := ABuffer.ReadWord; y := ABuffer.ReadWord;
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord); if (x < FRadar.Width) and (y < FRadar.Height) then
RepaintRadar; begin
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
RepaintRadar;
end;
end; end;
end; end;
end; end;