U8toU16 now respects buffer sizes

This commit is contained in:
2020-10-04 12:50:58 -05:00
parent 5015e2575d
commit 755bb75306
6 changed files with 11 additions and 8 deletions

View File

@@ -246,7 +246,7 @@ void ChatManager::sendServerMessage(CNSocket* sock, std::string msg) {
motd.iType = 1;
// convert string to u16 and write it to the buffer (TODO: add sanity check to prevent buffer overflow)
U8toU16(msg, (char16_t*)motd.szSystemMsg);
U8toU16(msg, (char16_t*)motd.szSystemMsg, sizeof(motd.szSystemMsg));
// send the packet :)
sock->sendPacket((void*)&motd, P_FE2CL_PC_MOTD_LOGIN, sizeof(sP_FE2CL_PC_MOTD_LOGIN));