From 216df844558e0f906c9f50ef0e770bd597e0b407 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 5 Feb 2016 11:23:23 +0000 Subject: Jabber: fix sha-1 hash corruption git-svn-id: http://svn.miranda-ng.org/main/trunk@16220 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_byte.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index a79b0d6aab..e70684225a 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -372,10 +372,10 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b JabberShaStrBuf buf; JabberSha1(szAuthString, buf); - for (i=0; i<40 && buffer[i+5]==buf[i]; i++); + for (i = 0; i < 40 && buffer[i + 5] == buf[i]; i++); memset(data, 0, sizeof(data)); - data[1] = (i>=20)?0:2; + data[1] = (i >= 20) ? 0 : 2; data[0] = 5; data[3] = 1; Netlib_Send(hConn, (char*)data, 10, 0); @@ -386,7 +386,7 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b if (jbt->state == JBT_ERROR) break; - if (i>=20 && (this->*jbt->pfnSend)(hConn, jbt->ft)==TRUE) + if (i >= 20 && (this->*jbt->pfnSend)(hConn, jbt->ft) == TRUE) jbt->state = JBT_DONE; else jbt->state = JBT_ERROR; @@ -520,7 +520,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch debugLogA("Auth: '%s'", szAuthString); JabberShaStrBuf buf; - strncpy_s((char*)(data + 5), 40, JabberSha1(szAuthString, buf), _TRUNCATE); + strncpy_s((char*)(data + 5), 40 + 1, JabberSha1(szAuthString, buf), _TRUNCATE); Netlib_Send(hConn, (char*)data, 47, 0); jbt->state = JBT_CONNECT; @@ -714,7 +714,7 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char debugLogA("Auth: '%s'", szAuthString); JabberShaStrBuf buf; - strncpy_s((char*)(data + 5), 40, JabberSha1(szAuthString, buf), _TRUNCATE); + strncpy_s((char*)(data + 5), 40 + 1, JabberSha1(szAuthString, buf), _TRUNCATE); Netlib_Send(hConn, (char*)data, 47, 0); jbt->state = JBT_CONNECT; -- cgit v1.2.3