diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-23 16:05:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-23 16:05:38 +0300 |
commit | 4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a (patch) | |
tree | 9de17304fb55adcb9db298af0299fe62be11b151 | |
parent | 75604ffe8c2ef1f2d76a44dc30e8a257b695daf5 (diff) | |
download | plus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.gz plus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.bz2 plus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.xz plus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.zip |
Fix sending packet CMSG_MAIL2_SEND_MAIL.
Add zero chars after strings.
-rw-r--r-- | src/net/eathena/mail2handler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net/eathena/mail2handler.cpp b/src/net/eathena/mail2handler.cpp index 513994d2a..f3ed3201d 100644 --- a/src/net/eathena/mail2handler.cpp +++ b/src/net/eathena/mail2handler.cpp @@ -116,8 +116,8 @@ void Mail2Handler::sendMail(const std::string &to, return; const std::string from = localPlayer->getName(); - const int titleSz = CAST_S32(title.size()); - const int bodySz = CAST_S32(body.size()); + const int titleSz = CAST_S32(title.size()) + 1; + const int bodySz = CAST_S32(body.size()) + 1; int32_t sz = 2 + 2 + 24 + 24 + 8 + 2 + 2 + titleSz + bodySz; if (sz > 32767 - 4) { @@ -132,8 +132,8 @@ void Mail2Handler::sendMail(const std::string &to, outMsg.writeString(to, 24, "to"); outMsg.writeString(from, 24, "from"); outMsg.writeInt64(money, "money"); - outMsg.writeInt16(CAST_S16(title.size()), "title len"); - outMsg.writeInt16(CAST_S16(body.size()), "body len"); + outMsg.writeInt16(CAST_S16(titleSz), "title len"); + outMsg.writeInt16(CAST_S16(bodySz), "body len"); if (packetVersion >= 20160600) outMsg.writeInt32(0, "to char id"); outMsg.writeString(title, titleSz, "title"); |