diff --git a/SteamKit2/SteamKit2/Base/ClientMsg.cs b/SteamKit2/SteamKit2/Base/ClientMsg.cs index f6279c311..689cc556e 100644 --- a/SteamKit2/SteamKit2/Base/ClientMsg.cs +++ b/SteamKit2/SteamKit2/Base/ClientMsg.cs @@ -191,8 +191,9 @@ public ClientMsgProtobuf( IPacketMsg msg ) Header = packetMsg.Header; - using MemoryStream ms = new MemoryStream( packetMsg.GetData() ); - ms.Seek( packetMsg.BodyOffset, SeekOrigin.Begin ); + var data = packetMsg.GetData(); + var offset = (int)packetMsg.BodyOffset; + using MemoryStream ms = new MemoryStream( data, offset, data.Length - offset ); Body = Serializer.Deserialize( ms ); @@ -353,8 +354,9 @@ public ClientMsg( IPacketMsg msg ) Header = packetMsg.Header; - using MemoryStream ms = new MemoryStream( packetMsg.GetData() ); - ms.Seek( packetMsg.BodyOffset, SeekOrigin.Begin ); + var data = packetMsg.GetData(); + var offset = (int)packetMsg.BodyOffset; + using MemoryStream ms = new MemoryStream( data, offset, data.Length - offset ); Body.Deserialize( ms ); @@ -506,8 +508,9 @@ public Msg( IPacketMsg msg ) Header = packetMsg.Header; - using MemoryStream ms = new MemoryStream( packetMsg.GetData() ); - ms.Seek( packetMsg.BodyOffset, SeekOrigin.Begin ); + var data = packetMsg.GetData(); + var offset = (int)packetMsg.BodyOffset; + using MemoryStream ms = new MemoryStream( data, offset, data.Length - offset ); Body.Deserialize( ms );