kdeconnect-kde/0004-Do-not-let-lanlink-connections-stay-open-for-long-wi.patch
Christophe Giboudeaux 41d68c2fd4 Accepting request 839167 from home:luca_b:branches:KDE:Applications
- Add upstream patches to fix security issues in kdeconnect
  (CVE-2020-26164, boo#1176268):
  * 0001-Do-not-leak-the-local-user-in-the-device-name.patch
  * 0002-Fix-use-after-free-in-LanLinkProvider-connectError.patch
  * 0003-Limit-identity-packets-to-8KiB.patch
  * 0004-Do-not-let-lanlink-connections-stay-open-for-long-wi.patch
  * 0005-Don-t-brute-force-reading-the-socket.patch
  * 0006-Limit-number-of-connected-sockets-from-unpaired-devi.patch
  * 0007-Do-not-remember-more-than-a-few-identity-packets-at-.patch
  * 0008-Limit-the-ports-we-try-to-connect-to-to-the-port-ran.patch
  * 0009-Do-not-replace-connections-for-a-given-deviceId-if-t.patch

OBS-URL: https://build.opensuse.org/request/show/839167
OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/kdeconnect-kde?expand=0&rev=17
2020-10-02 15:15:53 +00:00

38 lines
1.3 KiB
Diff

From 5310eae85dbdf92fba30375238a2481f2e34943e Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Wed, 16 Sep 2020 02:44:38 +0200
Subject: [PATCH 4/9] Do not let lanlink connections stay open for long without
authenticating
If there's no information received, close the socket to try again.
Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
---
core/backends/lan/lanlinkprovider.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp
index 1fd3870e..a4942c65 100644
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@ -374,6 +374,16 @@ void LanLinkProvider::newConnection()
connect(socket, &QIODevice::readyRead,
this, &LanLinkProvider::dataReceived);
+ QTimer* timer = new QTimer(socket);
+ timer->setSingleShot(true);
+ timer->setInterval(1000);
+ connect(socket, &QSslSocket::encrypted,
+ timer, &QObject::deleteLater);
+ connect(timer, &QTimer::timeout, socket, [socket] {
+ qCWarning(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Host timed out without sending any identity." << socket->peerAddress();
+ socket->disconnectFromHost();
+ });
+ timer->start();
}
}
--
2.28.0