diff options
author | Kai Koehne <kai.koehne@digia.com> | 2014-02-25 15:16:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-13 13:26:26 +0100 |
commit | 2350c7e35c7b21ab86e54e43d1e1bfddb1746922 (patch) | |
tree | 5a3c9ea48ad5b7e73538af418c3b525fcbc71bed /src/corelib/io/qloggingregistry.cpp | |
parent | b3871dc8049819ae3e095555f451457567eb4ee3 (diff) |
Make parsing of categories in logging rules more strict
Do not accept rules with wildcards in the middle.
Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qloggingregistry.cpp')
-rw-r--r-- | src/corelib/io/qloggingregistry.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 20eb2e13f5..ab29c42325 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -134,20 +134,20 @@ void QLoggingRule::parse(const QString &pattern) messageType = QtCriticalMsg; } - int index = category.indexOf(QLatin1Char('*')); - if (index < 0) { + flags = Invalid; + if (!category.contains(QLatin1Char('*'))) { flags = FullText; } else { - flags = Invalid; - if (index == 0) { - flags |= RightFilter; - category.remove(0, 1); - index = category.indexOf(QLatin1Char('*')); - } - if (index == (category.length() - 1)) { + if (category.endsWith(QLatin1Char('*'))) { flags |= LeftFilter; category.chop(1); } + if (category.startsWith(QLatin1Char('*'))) { + flags |= RightFilter; + category.remove(0, 1); + } + if (category.contains(QLatin1Char('*'))) // '*' only supported at start/end + flags = Invalid; } } |