summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-09-05 02:13:20 +0300
committerAndrei Karas <akaras@inbox.ru>2017-09-05 02:13:20 +0300
commit0491808a50932918ce09c98a394a941b9239670a (patch)
treec2f0cc388e4b7951ecc0b275746c1796f845522b /src/net
parent9e48f292f14fe96c98b5cfe18a32bcb1bc3d7c24 (diff)
downloadmv-0491808a50932918ce09c98a394a941b9239670a.tar.gz
mv-0491808a50932918ce09c98a394a941b9239670a.tar.bz2
mv-0491808a50932918ce09c98a394a941b9239670a.tar.xz
mv-0491808a50932918ce09c98a394a941b9239670a.zip
Fix receiving half broken packet with mail message (SMSG_MAIL2_READ_MAIL).
Where items present in count, but not present in data.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/mail2recv.cpp3
1 files changed, 3 insertions, 0 deletions
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");