From 4da8a6304b5b7bb4d2b655ed3471c0ff4a7d610a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Aug 2017 16:05:38 +0300 Subject: Fix sending packet CMSG_MAIL2_SEND_MAIL. Add zero chars after strings. --- src/net/eathena/mail2handler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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"); -- cgit v1.2.3-60-g2f50