From 2c47f09d7a797c1ea886879749b71198e449e701 Mon Sep 17 00:00:00 2001 From: Hanabishi <13597663+HanabishiRecca@users.noreply.github.com> Date: Sat, 11 May 2024 20:46:11 +0500 Subject: [PATCH] Sanitize peer client names PR #20788. Closes #20010. --- src/base/bittorrent/peerinfo.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/base/bittorrent/peerinfo.cpp b/src/base/bittorrent/peerinfo.cpp index 9fb6db21a..cf27ba302 100644 --- a/src/base/bittorrent/peerinfo.cpp +++ b/src/base/bittorrent/peerinfo.cpp @@ -198,7 +198,12 @@ QString PeerInfo::I2PAddress() const QString PeerInfo::client() const { - return QString::fromStdString(m_nativeInfo.client); + auto client = QString::fromStdString(m_nativeInfo.client).simplified(); + + // remove non-printable characters + erase_if(client, [](const QChar &c) { return !c.isPrint(); }); + + return client; } QString PeerInfo::peerIdClient() const