From cbbc18706ae83dc0df9c3a6e417a52eec124db2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Jun 2013 18:12:25 +0000 Subject: crash fix git-svn-id: http://svn.miranda-ng.org/main/trunk@5024 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'protocols/WhatsApp') diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp index a1a3d26a94..37d5fe0378 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp @@ -184,11 +184,10 @@ std::vector* WALogin::getAuthBlob(const std::vectorinsert(list->end(), this->user.begin(), this->user.end()); list->insert(list->end(), nonce.begin(), nonce.end()); - time_t now; - std::string time = Utilities::intToStr(difftime(mktime(gmtime(&now)), 0)); - list->insert(list->end(), time.begin(), time.end()); + std::string strTime = Utilities::intToStr( time(NULL)); + list->insert(list->end(), strTime.begin(), strTime.end()); - this->outputKey->encodeMessage(&((*list)[0]), 0, 4, list->size() - 4); + this->outputKey->encodeMessage(&((*list)[0]), 0, 4, (int)list->size() - 4); return list; } @@ -281,7 +280,7 @@ KeyStream::KeyStream(unsigned char* key, size_t keyLength) { this->key = new unsigned char[keyLength]; memcpy(this->key, key, keyLength); - this->keyLength = keyLength; + this->keyLength = (int)keyLength; RC4_set_key(&this->rc4, this->keyLength, this->key); RC4(&this->rc4, 256, drop, drop); @@ -294,7 +293,7 @@ KeyStream::~KeyStream() { } void KeyStream::keyFromPasswordAndNonce(const std::string& pass, const std::vector& nonce, unsigned char *out) { - PKCS5_PBKDF2_HMAC_SHA1(pass.data(), pass.size(), nonce.data(), nonce.size(), 16, 20, out); + PKCS5_PBKDF2_HMAC_SHA1(pass.data(), (int)pass.size(), nonce.data(), (int)nonce.size(), 16, 20, out); } void KeyStream::decodeMessage(unsigned char* buffer, int macOffset, int offset, const int length) { -- cgit v1.2.3