aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2023-02-23 12:46:34 +0100
committerLinus Jahn <lnj@kaidan.im>2023-02-23 12:46:34 +0100
commite8f4e4b6ad97227f2f248014e0f0d58a51305e7d (patch)
tree992616e7483c177b9e59344ec4ed33c0d6d6cc99
parent450a08ff7f6c7889e2fc745666eec02bafd7998f (diff)
parenta06db8e3469a0c7acd8f5e6bc6502ad16f1d59b8 (diff)
Merge branch '1.5'
-rw-r--r--CHANGELOG.md7
-rw-r--r--src/base/QXmppStun.cpp4
-rw-r--r--src/client/QXmppFileSharingManager.cpp2
-rw-r--r--src/omemo/QXmppOmemoManager_p.cpp15
4 files changed, 21 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e235b35..817e15d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,13 @@ QXmpp 1.6.0 (UNRELEASED)
*under development*
+QXmpp 1.5.2 (Feb 23, 2023)
+--------------------------
+
+Fixes:
+ - Fix undefined behaviour in OmemoManager and FileSharingManager (@lnjX)
+ - STUN: Fix nonce attribute is not padded (@Choochmeque)
+
QXmpp 1.5.1 (Feb 01, 2023)
--------------------------
diff --git a/src/base/QXmppStun.cpp b/src/base/QXmppStun.cpp
index 8a7e61c3..9a2b3932 100644
--- a/src/base/QXmppStun.cpp
+++ b/src/base/QXmppStun.cpp
@@ -916,6 +916,10 @@ QByteArray QXmppStunMessage::encode(const QByteArray &key, bool addFingerprint)
stream << quint16(Nonce);
stream << quint16(m_nonce.size());
stream.writeRawData(m_nonce.data(), m_nonce.size());
+ if (m_nonce.size() % 4) {
+ const QByteArray padding(4 - (m_nonce.size() % 4), 0);
+ stream.writeRawData(padding.data(), padding.size());
+ }
}
// REALM
diff --git a/src/client/QXmppFileSharingManager.cpp b/src/client/QXmppFileSharingManager.cpp
index 7924f9eb..660ea5e2 100644
--- a/src/client/QXmppFileSharingManager.cpp
+++ b/src/client/QXmppFileSharingManager.cpp
@@ -566,7 +566,7 @@ std::shared_ptr<QXmppFileDownload> QXmppFileSharingManager::downloadFile(
std::move(file),
transform(download->d->hashes, [](auto hash) { return hash; }));
- await(download->d->hashesFuture, this, [download = std::move(download)](HashVerificationResultPtr hashResult) {
+ await(download->d->hashesFuture, this, [download](HashVerificationResultPtr hashResult) {
auto convert = overloaded {
[](HashVerificationResult::NoStrongHashes) {
return QXmppFileDownload::Downloaded {
diff --git a/src/omemo/QXmppOmemoManager_p.cpp b/src/omemo/QXmppOmemoManager_p.cpp
index ca625322..2e08da04 100644
--- a/src/omemo/QXmppOmemoManager_p.cpp
+++ b/src/omemo/QXmppOmemoManager_p.cpp
@@ -629,14 +629,17 @@ QXmppTask<bool> ManagerPrivate::setUpDeviceId()
// 2. There is an empty PubSub node for device bundles: XEP-0030 states that a server must
// respond with a node without included items.
auto error = std::get_if<QXmppError>(&result);
- if (auto stanzaErr = error->value<QXmppStanza::Error>()) {
- // allow Cancel|ItemNotFound here
- if (!(stanzaErr->type() == Error::Cancel && stanzaErr->condition() == Error::ItemNotFound)) {
- warning("Existing / Published device IDs could not be retrieved: " % errorToString(*error));
+ if (error) {
+ if (auto stanzaErr = error->value<QXmppStanza::Error>()) {
+ // allow Cancel|ItemNotFound here
+ if (!(stanzaErr->type() == Error::Cancel && stanzaErr->condition() == Error::ItemNotFound)) {
+ warning("Existing / Published device IDs could not be retrieved: " % errorToString(*error));
+ return false;
+ }
+ // do not return here
+ } else {
return false;
}
- } else {
- return false;
}
// The first generated device ID can be used if no device bundle node exists.