diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-03 00:41:21 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-04 19:14:51 +0000 |
commit | bf2ad740b57510e63ec10507cf8502f616cd53b5 (patch) | |
tree | 822e0126bd1452b181dec233dc9229e43e725a79 /src/testlib | |
parent | 49ce7bfdcfe8616b6aa5353ed9b54fd4b859dd5c (diff) |
QTeamCityLogger: fix .arg() placeholder injection
Since each .arg() call starts from scratch, a file name containing a
suitable %n would mess up the formatting of the following .arg() call.
Fix by using multiArg(), which requires to pre-format the line into a
QString, but which performs only a single-pass, so doesn't suffer from
the placeholder injection problem that plagues .arg()-chaining.
Change-Id: I549527643da657fca0bea63d5e3becadac529d4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit c9f4cb2c9267fd1ad0d90b1a817e7417f1ea23ff)
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qteamcitylogger.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/testlib/qteamcitylogger.cpp b/src/testlib/qteamcitylogger.cpp index 71eac5b797..f47ac1c3e1 100644 --- a/src/testlib/qteamcitylogger.cpp +++ b/src/testlib/qteamcitylogger.cpp @@ -268,9 +268,8 @@ void QTeamCityLogger::addPendingMessage(const char *type, const QString &msg, co if (file) { pendMessage += QString(QLatin1String("%1 |[Loc: %2(%3)|]: %4")) - .arg(QString::fromUtf8(type), QString::fromUtf8(file)) - .arg(line) - .arg(msg); + .arg(QString::fromUtf8(type), QString::fromUtf8(file), + QString::number(line), msg); } else { |