Compare commits

...

2 Commits

Author SHA1 Message Date
c4eb4a481b
Merge 810ccffd9e into 52833f7fb3 2024-09-06 15:58:37 +00:00
810ccffd9e
Fix bad size calculation due to pointer cast 2024-09-06 11:58:26 -04:00
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@
// wrapper for U16toU8 // wrapper for U16toU8
#define ARRLEN(x) (sizeof(x)/sizeof(*x)) #define ARRLEN(x) (sizeof(x)/sizeof(*x))
#define AUTOU8(x) std::string(x, ARRLEN(x)) #define AUTOU8(x) std::string((char*)x, ARRLEN(x))
#define AUTOU16TOU8(x) U16toU8(x, ARRLEN(x)) #define AUTOU16TOU8(x) U16toU8(x, ARRLEN(x))
// TODO: rewrite U16toU8 & U8toU16 to not use codecvt // TODO: rewrite U16toU8 & U8toU16 to not use codecvt

View File

@ -116,11 +116,11 @@ void CNLoginServer::login(CNSocket* sock, CNPacketData* data) {
*/ */
if (isCookieAuth) { if (isCookieAuth) {
// username encoded in TEGid raw // username encoded in TEGid raw
userLogin = std::string(AUTOU8((char*)login->szCookie_TEGid).c_str()); userLogin = std::string(AUTOU8(login->szCookie_TEGid).c_str());
// N.B. clients that use web login without proper cookies // N.B. clients that use web login without proper cookies
// send their passwords in the cookie field // send their passwords in the cookie field
userPassword = std::string(AUTOU8((char*)login->szCookie_authid).c_str()); userPassword = std::string(AUTOU8(login->szCookie_authid).c_str());
} else { } else {
userLogin = std::string(AUTOU16TOU8(login->szID).c_str()); userLogin = std::string(AUTOU16TOU8(login->szID).c_str());
userPassword = std::string(AUTOU16TOU8(login->szPassword).c_str()); userPassword = std::string(AUTOU16TOU8(login->szPassword).c_str());