From be9971449538474884af3fe2e0419cf78e600439 Mon Sep 17 00:00:00 2001 From: dongresource Date: Sat, 12 Sep 2020 17:09:11 +0200 Subject: [PATCH] Possible fix for the login error bug. --- src/CNLoginServer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CNLoginServer.cpp b/src/CNLoginServer.cpp index 6ec17c0..e1ac611 100644 --- a/src/CNLoginServer.cpp +++ b/src/CNLoginServer.cpp @@ -29,10 +29,14 @@ void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) { std::string userLogin((char*)login->szCookie_TEGid); std::string userPassword((char*)login->szCookie_authid); + /* + * The std::string -> char* -> std::string maneuver should remove any + * trailing garbage after the null terminator. + */ if (userLogin.length() == 0) - userLogin = U16toU8(login->szID); + userLogin = std::string(U16toU8(login->szID).c_str()); if (userPassword.length() == 0) - userPassword = U16toU8(login->szPassword); + userPassword = std::string(U16toU8(login->szPassword).c_str()); bool success = false; int errorCode = 0;