From 35f71c75348ac31c93a97ecf49bb6f3b14539e0e Mon Sep 17 00:00:00 2001 From: Darren Horrocks Date: Sat, 21 Oct 2023 00:09:29 +0100 Subject: [PATCH] possible not enough data bug in PWP --- bzTorrent/Data/PeerWirePacket.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bzTorrent/Data/PeerWirePacket.cs b/bzTorrent/Data/PeerWirePacket.cs index 43e64d3..f155d23 100644 --- a/bzTorrent/Data/PeerWirePacket.cs +++ b/bzTorrent/Data/PeerWirePacket.cs @@ -42,6 +42,11 @@ public class PeerWirePacket public bool Parse(byte[] currentPacketBuffer) { + if(currentPacketBuffer.Length < 4) + { + return false; + } + var commandLength = UnpackHelper.UInt32(currentPacketBuffer, 0, UnpackHelper.Endianness.Big); CommandLength = commandLength;