summaryrefslogtreecommitdiff
path: root/protocols/WhatsAppWeb/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsAppWeb/src')
-rw-r--r--protocols/WhatsAppWeb/src/utils.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/protocols/WhatsAppWeb/src/utils.cpp b/protocols/WhatsAppWeb/src/utils.cpp
index 853c5ae383..4300256cf7 100644
--- a/protocols/WhatsAppWeb/src/utils.cpp
+++ b/protocols/WhatsAppWeb/src/utils.cpp
@@ -67,16 +67,17 @@ bool WhatsAppProto::decryptBinaryMessage(size_t cbSize, const void *buf, MBinBuf
}
// okay, let's decrypt this thing
+ auto *pBuf = (const unsigned char *)buf;
{
BYTE iv[16];
- memcpy(iv, (char*)buf + 32, sizeof(iv));
- res.assign((char*)buf + 48, cbSize - 48);
- res.append((char*)mac_key.data(), 32); // reserve 32 more bytes for temp data
+ memcpy(iv, pBuf + 32, sizeof(iv));
+ res.assign(pBuf + 48, cbSize - 48);
+ res.append(mac_key.data(), 32); // reserve 32 more bytes for temp data
int dec_len = 0, final_len = 0;
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, (BYTE*)enc_key.data(), iv);
- EVP_DecryptUpdate(ctx, (BYTE*)res.data(), &dec_len, (BYTE*)buf + 48, (int)cbSize - 48);
+ EVP_DecryptUpdate(ctx, (BYTE*)res.data(), &dec_len, pBuf + 48, (int)cbSize - 48);
EVP_DecryptFinal_ex(ctx, (BYTE*)res.data() + dec_len, &final_len);
EVP_CIPHER_CTX_free(ctx);
}
@@ -517,7 +518,7 @@ void WAWriter::writeString(const char *str, bool bRaw)
else {
int len = (int)strlen(str);
writeLength(len);
- body.append((void *)str, len);
+ body.append(str, len);
}
}