summaryrefslogtreecommitdiff
path: root/src/net/eathena/mail2handler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-23 16:05:38 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-23 16:05:38 +0300
commit4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a (patch)
tree9de17304fb55adcb9db298af0299fe62be11b151 /src/net/eathena/mail2handler.cpp
parent75604ffe8c2ef1f2d76a44dc30e8a257b695daf5 (diff)
downloadmanaplus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.gz
manaplus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.bz2
manaplus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.tar.xz
manaplus-4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a.zip
Fix sending packet CMSG_MAIL2_SEND_MAIL.
Add zero chars after strings.
Diffstat (limited to 'src/net/eathena/mail2handler.cpp')
-rw-r--r--src/net/eathena/mail2handler.cpp8
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");