summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/appsync.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-15 12:49:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-15 12:49:25 +0300
commitf708f2a55a467092b70a537c2b97c9210440a420 (patch)
treebec7d1200a546bfdac30ec64278673217d6e6365 /protocols/WhatsApp/src/appsync.cpp
parent85bcf4d780a31fd88508ae42ba825394a0911a5d (diff)
fixes #3245 (WhatsApp: crash on login) + code cleaning
Diffstat (limited to 'protocols/WhatsApp/src/appsync.cpp')
-rw-r--r--protocols/WhatsApp/src/appsync.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/protocols/WhatsApp/src/appsync.cpp b/protocols/WhatsApp/src/appsync.cpp
index f976c580b6..928e78fe50 100644
--- a/protocols/WhatsApp/src/appsync.cpp
+++ b/protocols/WhatsApp/src/appsync.cpp
@@ -100,7 +100,7 @@ void WhatsAppProto::OnIqServerSync(const WANode &node)
}
MBinBuffer buf = DownloadEncryptedFile(directPath2url(body->directpath), body->mediakey, "App State");
- if (!buf.data()) {
+ if (buf.isEmpty()) {
debugLogA("Invalid downloaded snapshot data, skipping");
continue;
}
@@ -163,7 +163,7 @@ void WhatsAppProto::ParsePatch(WACollection *pColl, const Wa__SyncdRecord *rec,
std::string index((char *)indexBlob.data, indexBlob.len);
MBinBuffer key(getBlob(CMStringA(FORMAT, "AppSyncKey%d", id)));
- if (!key.data()) {
+ if (key.isEmpty()) {
debugLogA("No key with id=%d to decode a patch");
return;
}
@@ -181,7 +181,7 @@ void WhatsAppProto::ParsePatch(WACollection *pColl, const Wa__SyncdRecord *rec,
HKDF(EVP_sha256(), (BYTE *)"", 0, key.data(), key.length(), sttMutationInfo, sizeof(sttMutationInfo) - 1, (BYTE *)&mutationKeys, sizeof(mutationKeys));
MBinBuffer decoded = aesDecrypt(EVP_aes_256_cbc(), mutationKeys.encKey, value.data, value.data + 16, value.len - 32);
- if (!decoded.data()) {
+ if (decoded.isEmpty()) {
debugLogA("Unable to decode patch with key id=%d", id);
return;
}