summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2025-03-30 21:23:00 +0000
committerFedja Beader <fedja@protonmail.ch>2025-03-30 21:23:00 +0000
commit0699a43d5db9612cc66be9bcb3e45ce788771ee0 (patch)
treeb6931e9c936b9956a749848affcb788189081e3a
parentca989afcaf5bc81289afd4edf244d81418a90ac8 (diff)
downloadmv-0699a43d5db9612cc66be9bcb3e45ce788771ee0.tar.gz
mv-0699a43d5db9612cc66be9bcb3e45ce788771ee0.tar.bz2
mv-0699a43d5db9612cc66be9bcb3e45ce788771ee0.tar.xz
mv-0699a43d5db9612cc66be9bcb3e45ce788771ee0.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);
}