diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-03-30 21:23:00 +0000 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-03-30 21:23:00 +0000 |
commit | 0699a43d5db9612cc66be9bcb3e45ce788771ee0 (patch) | |
tree | b6931e9c936b9956a749848affcb788189081e3a | |
parent | ca989afcaf5bc81289afd4edf244d81418a90ac8 (diff) | |
download | mv-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.cpp | 3 |
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); } |