amnezia-vpn/amnezia-client

client crushed when local user profile path contains non-ascii characters

OlkhinAG opened this issue · 0 comments

Describe the bug
Client crash when installing any service on server.
event log shows error code 0xc0000409

Spotted on windows 10.
Tracked it to sftpFileCopy function, exception raises on accessing localPath.
Problem is that QTemporaryFile created in user profile and when path converted to std::string it makes it utf8, but std file functions on windows do not understand uft8.

replaced line

error = m_sshClient.sftpFileCopy(overwriteMode, localFile.fileName().toStdString(), remotePath.toStdString(),
                                     "non_desc");

with

error = m_sshClient.sftpFileCopy(overwriteMode, localFile.fileName().toLocal8Bit().toStdString(), remotePath.toStdString(),
                                     "non_desc");

in \client\core\servercontroller.cpp and error gone

maybe using std::filesystem::path in sftpFileCopy is better idea