summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_secur.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /protocols/JabberG/src/jabber_secur.cpp
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_secur.cpp')
-rw-r--r--protocols/JabberG/src/jabber_secur.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp
index 5bebb8ac3a..24c93439db 100644
--- a/protocols/JabberG/src/jabber_secur.cpp
+++ b/protocols/JabberG/src/jabber_secur.cpp
@@ -50,7 +50,7 @@ LBL_Invalid:
TCHAR szSpn[1024] = _T("");
if (mir_strcmp(mechanism, "NTLM"))
- if (!getSpn(szSpn, SIZEOF(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
+ if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
goto LBL_Invalid;
if ((hProvider = Netlib_InitSecurityProvider2(szProvider, szSpn)) == NULL)
@@ -66,10 +66,10 @@ TNtlmAuth::~TNtlmAuth()
bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
{
TCHAR szFullUserName[128] = _T("");
- ULONG szFullUserNameLen = SIZEOF(szFullUserName);
+ ULONG szFullUserNameLen = _countof(szFullUserName);
if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[0] = 0;
- szFullUserNameLen = SIZEOF(szFullUserName);
+ szFullUserNameLen = _countof(szFullUserName);
GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
}
@@ -155,7 +155,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge)
mir_md5_state_t ctx;
CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest);
- mir_snprintf(cnonce, SIZEOF(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
+ mir_snprintf(cnonce, _countof(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
T2Utf uname(info->conn.username), passw(info->conn.password);
ptrA serv(mir_utf8encode(info->conn.server));
@@ -182,15 +182,15 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge)
mir_md5_finish(&ctx, (BYTE*)hash2);
mir_md5_init(&ctx);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)":", 1);
mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce));
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), ":%08d:", iCallCount);
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce));
mir_md5_append(&ctx, (BYTE*)":auth:", 6);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_finish(&ctx, (BYTE*)digest);
@@ -278,7 +278,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge)
mir_sha1_finish(&ctx, storedKey);
char authmsg[4096];
- int authmsgLen = mir_snprintf(authmsg, SIZEOF(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
+ int authmsgLen = mir_snprintf(authmsg, _countof(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
BYTE clientSig[MIR_SHA1_HASH_SIZE];
mir_hmac_sha1(clientSig, storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen);