summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_system_cpp.h3
-rw-r--r--libs/win32/mir_core.libbin461402 -> 461678 bytes
-rw-r--r--libs/win64/mir_core.libbin466190 -> 466482 bytes
-rw-r--r--protocols/WhatsAppWeb/src/server.cpp6
-rw-r--r--src/mir_core/src/binbuffer.cpp13
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
7 files changed, 21 insertions, 3 deletions
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h
index a592311f37..36b8119684 100644
--- a/include/m_system_cpp.h
+++ b/include/m_system_cpp.h
@@ -382,6 +382,9 @@ public:
// adds a buffer to the beginning
void appendBefore(void *pBuf, size_t bufLen);
+ // replaces buffer contents
+ void assign(void *pBuf, size_t bufLen);
+
// drops a part of buffer
void remove(size_t sz);
};
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index 6c799c8aa7..99be1dce2a 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index 73f13f4b78..3e2ceafd8a 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
diff --git a/protocols/WhatsAppWeb/src/server.cpp b/protocols/WhatsAppWeb/src/server.cpp
index 8b183ab308..698cfa6d2e 100644
--- a/protocols/WhatsAppWeb/src/server.cpp
+++ b/protocols/WhatsAppWeb/src/server.cpp
@@ -135,7 +135,7 @@ bool WhatsAppProto::getBlob(const char *szSetting, MBinBuffer &buf)
if (db_get(0, m_szModuleName, szSetting, &dbv))
return false;
- buf.append(dbv.pbVal, dbv.cpbVal);
+ buf.assign(dbv.pbVal, dbv.cpbVal);
db_free(&dbv);
return true;
}
@@ -282,8 +282,8 @@ bool WhatsAppProto::ProcessSecret(const CMStringA &szSecret)
dec_len += final_len;
EVP_CIPHER_CTX_free(ctx);
- enc_key.append(dec, 32);
- mac_key.append(dec + 32, 32);
+ enc_key.assign(dec, 32);
+ mac_key.assign(dec + 32, 32);
db_set_blob(0, m_szModuleName, DBKEY_ENC_KEY, enc_key.data(), (int)enc_key.length());
db_set_blob(0, m_szModuleName, DBKEY_MAC_KEY, mac_key.data(), (int)mac_key.length());
diff --git a/src/mir_core/src/binbuffer.cpp b/src/mir_core/src/binbuffer.cpp
index 3ca6f871f3..90d987881c 100644
--- a/src/mir_core/src/binbuffer.cpp
+++ b/src/mir_core/src/binbuffer.cpp
@@ -55,6 +55,19 @@ void MBinBuffer::appendBefore(void *pBuf, size_t bufLen)
else m_len = 0;
}
+void MBinBuffer::assign(void *pBuf, size_t bufLen)
+{
+ if (pBuf == nullptr || bufLen == 0)
+ return;
+
+ m_buf = (char *)mir_realloc(m_buf, bufLen);
+ if (m_buf) {
+ memcpy(m_buf, pBuf, bufLen);
+ m_len = bufLen;
+ }
+ else m_len = 0;
+}
+
void MBinBuffer::remove(size_t sz)
{
if (sz > m_len)
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 7069b1e3f2..3163bc75d7 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1450,3 +1450,4 @@ XmlGetChildText @1645
?Unsigned64Text@XMLElement@tinyxml2@@QBE_K_K@Z @1665 NONAME
?Unsigned64Value@XMLAttribute@tinyxml2@@QBE_KXZ @1666 NONAME
?RemoveControl@CDlgBase@@IAEXPAVCCtrlBase@@@Z @1667 NONAME
+?assign@MBinBuffer@@QAEXPAXI@Z @1668 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 7cc4be7567..e0ecff0900 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1450,3 +1450,4 @@ XmlGetChildText @1645
?Unsigned64Text@XMLElement@tinyxml2@@QEBA_K_K@Z @1665 NONAME
?Unsigned64Value@XMLAttribute@tinyxml2@@QEBA_KXZ @1666 NONAME
?RemoveControl@CDlgBase@@IEAAXPEAVCCtrlBase@@@Z @1667 NONAME
+?assign@MBinBuffer@@QEAAXPEAX_K@Z @1668 NONAME