Skip to content

Commit

Permalink
Sanitize peer client names
Browse files Browse the repository at this point in the history
PR #20788.
Closes #20010.
  • Loading branch information
HanabishiRecca committed May 11, 2024
1 parent a19ef58 commit 2c47f09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/base/bittorrent/peerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c47f09

Please sign in to comment.