Skip to content

Commit

Permalink
fix(security): Only allow printable characters in incoming messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Nov 24, 2024
1 parent bb1324e commit 70890de
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/toxstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ size_t ToxString::size() const
*/
QString ToxString::getQString() const
{
return QString::fromUtf8(string);
const QString tainted = QString::fromUtf8(string);
QString cleaned;
std::copy_if(tainted.begin(), tainted.end(), std::back_inserter(cleaned), [](QChar c) { return c.isPrint(); });
return cleaned;
}

/**
Expand Down

0 comments on commit 70890de

Please sign in to comment.