From 7b2b0c93109a5b2d85c5c02407109efdbba6aafa Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 2 Dec 2017 16:46:17 +0100 Subject: [PATCH] Fixed: Encode password in hexadecimal on command-line when patching to avoid invalid characters --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 13 +++++++++++++ code/ryzom/client/src/login_patch.cpp | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index c92bb887b..4c0121d2e 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -205,6 +205,19 @@ int main(int argc, char **argv) { LoginPassword = Args.getAdditionalArg("password").front(); + // password in hexadecimal + if (LoginPassword.compare(0, 2, "0x") == 0) + { + std::string decodedPassword; + + // decode password + if (fromHexa(LoginPassword.substr(2), decodedPassword)) + { + // only use it if real hexadecimal + LoginPassword = decodedPassword; + } + } + if (Args.haveAdditionalArg("shard_id")) sLoginShardId = Args.getAdditionalArg("shard_id").front(); } diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index f13d1a782..27ade135e 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -1036,7 +1036,8 @@ void CPatchManager::executeBatchFile() if (!LoginPassword.empty()) { - arguments.push_back(LoginPassword); + // encode password in hexadecimal to avoid invalid characters on command-line + arguments.push_back("0x" + toHexa(LoginPassword)); if (!r2Mode) {