🚨 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
begin
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);
//frmMain.Enabled := True;
frmInitialize.UnsetModal;
@@ -227,8 +228,11 @@ begin
begin
x := ABuffer.ReadWord;
y := ABuffer.ReadWord;
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
RepaintRadar;
if (x < FRadar.Width) and (y < FRadar.Height) then
begin
PInteger(FRadar.PixelPointer[x, y])^ := DecodeUOColor(ABuffer.ReadWord);
RepaintRadar;
end;
end;
end;
end;