summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-03-30 21:23:00 +0000
committerFedja Beader <fedja@protonmail.ch>2025-04-01 01:53:36 +0200
commita94c27d7f187b6878809bbc756cd00c4c49c7b2a (patch)
tree8760f34b92df56befc966e205397be6ca0700a43
parentc7a01a480e111b88efe53e8abb9bcca801332f4d (diff)
downloadmanaplus-a94c27d7f187b6878809bbc756cd00c4c49c7b2a.tar.gz
manaplus-a94c27d7f187b6878809bbc756cd00c4c49c7b2a.tar.bz2
manaplus-a94c27d7f187b6878809bbc756cd00c4c49c7b2a.tar.xz
manaplus-a94c27d7f187b6878809bbc756cd00c4c49c7b2a.zip
processTradeResponse: Fix a potential early exit before full packet is read
Not sure how to trigger this one, couldn't do it with a few simple tests. **** mana/plus!149
-rw-r--r--src/net/tmwa/traderecv.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/tmwa/traderecv.cpp b/src/net/tmwa/traderecv.cpp
index 1f4079e7c..433a1f62f 100644
--- a/src/net/tmwa/traderecv.cpp
+++ b/src/net/tmwa/traderecv.cpp
@@ -158,6 +158,8 @@ void TradeRecv::processTradeItemAddResponse(Net::MessageIn &msg)
void TradeRecv::processTradeResponse(Net::MessageIn &msg)
{
+ const uint8_t type = msg.readUInt8("type");
+
if (tradePartnerName.empty() ||
!playerRelations.hasPermission(tradePartnerName,
PlayerRelation::TRADE))
@@ -165,7 +167,6 @@ void TradeRecv::processTradeResponse(Net::MessageIn &msg)
tradeHandler->respond(false);
return;
}
- const uint8_t type = msg.readUInt8("type");
Ea::TradeRecv::processTradeResponseContinue(type);
}