From d18e01c95c48a3df4bdf7e04a8df2172b046082a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 15 Nov 2026 09:24:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=92=20Validate=20login=20response=20fi?= =?UTF-8?q?elds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The access level byte and landscape dimensions were trusted from the network without checks. --- Client/UdmNetwork.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Client/UdmNetwork.pas b/Client/UdmNetwork.pas index 58c5c58..420fd1c 100644 --- a/Client/UdmNetwork.pas +++ b/Client/UdmNetwork.pas @@ -163,6 +163,7 @@ procedure TdmNetwork.OnConnectionHandlingPacket(ABuffer: TEnhancedMemoryStream); var subID: Byte; loginState: TLoginState; + levelByte: Byte; width, height: Word; serverState: TServerState; begin @@ -189,10 +190,19 @@ begin frmInitialize.Repaint; frmInitialize.lblStatus.Repaint; Application.ProcessMessages; - FAccessLevel := TAccessLevel(ABuffer.ReadByte); + levelByte := ABuffer.ReadByte; + if levelByte in [0, 1, 2, 255] then + FAccessLevel := TAccessLevel(accessLevel) + else + FAccessLevel := alNone; InitGameResourceManager(FDataDir); width := ABuffer.ReadWord; height := ABuffer.ReadWord; + if (width = 0) or (height = 0) then + begin + Disconnect; + Exit; + end; ResMan.InitLandscape(width, height); ResMan.Landscape.UpdateWriteMap(ABuffer);