diff options
author | George Hazan <ghazan@miranda.im> | 2019-02-01 12:32:01 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-02-01 12:32:01 +0300 |
commit | bad4507664d3c68ad602e15ad3820e4ce11aa13f (patch) | |
tree | 64b86335edadd7aad0134f8685d5f6f0baedd88c /src/mir_app | |
parent | b0a9d63d5ec91ffbfb48c04bc980e241c6b0d65d (diff) |
ะก magic removed
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/netlibsecurity.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp index b30146e7ca..46c4d9fa0d 100644 --- a/src/mir_app/src/netlibsecurity.cpp +++ b/src/mir_app/src/netlibsecurity.cpp @@ -244,21 +244,16 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, // Negotiate ANSI? if yes, convert the ANSI name to unicode
if ((pkt->flags & 1) == 0) {
int bufsz = MultiByteToWideChar(CP_ACP, 0, (char*)domainName, domainLen, nullptr, 0);
- wchar_t* buf = (wchar_t*)alloca(bufsz * sizeof(wchar_t));
+ wchar_t* buf = (wchar_t*)alloca((bufsz+1) * sizeof(wchar_t));
domainLen = MultiByteToWideChar(CP_ACP, 0, (char*)domainName, domainLen, buf, bufsz) - 1;
+ buf[domainLen] = 0;
domainName = buf;
}
else domainLen /= sizeof(wchar_t);
if (domainLen) {
- size_t newLoginLen = mir_wstrlen(login) + domainLen + 1;
- wchar_t *newLogin = (wchar_t*)alloca(newLoginLen * sizeof(wchar_t));
-
- wcsncpy(newLogin, domainName, domainLen);
- newLogin[domainLen] = '\\';
- mir_wstrcpy(newLogin + domainLen + 1, login);
-
- char* szChl = NtlmCreateResponseFromChallenge(hSecurity, nullptr, newLogin, psw, http, complete);
+ CMStringW wszNewLogin(FORMAT, L"%s\\%s", domainName, login);
+ char* szChl = NtlmCreateResponseFromChallenge(hSecurity, nullptr, wszNewLogin, psw, http, complete);
mir_free(szChl);
}
}
|