From 0491808a50932918ce09c98a394a941b9239670a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 Sep 2017 02:13:20 +0300 Subject: Fix receiving half broken packet with mail message (SMSG_MAIL2_READ_MAIL). Where items present in count, but not present in data. --- src/net/eathena/mail2recv.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/net/eathena/mail2recv.cpp b/src/net/eathena/mail2recv.cpp index b2e435bee..8b4d1dd8b 100644 --- a/src/net/eathena/mail2recv.cpp +++ b/src/net/eathena/mail2recv.cpp @@ -406,6 +406,9 @@ void Mail2Recv::processReadMail(Net::MessageIn &msg) for (int f = 0; f < itemsCount; f ++) { + // server may send wrong items count, if items was removed from mail + if (msg.getUnreadLength() == 0) + break; const int amount = msg.readInt16("amount"); const int itemId = msg.readInt16("item id"); const uint8_t identify = msg.readUInt8("identify"); -- cgit v1.2.3-60-g2f50