diff options
author | David Faure <faure@kde.org> | 2019-08-07 09:35:36 +0200 |
---|---|---|
committer | l10n daemon script <scripty@kde.org> | 2019-08-07 20:04:08 +0000 |
commit | 01674d7d5b1d8d0f21193f00265bf923fda71dc1 (patch) | |
tree | 8c366adfc1663bdfd9a51e0cb48be367f595d716 /src/core/kconfig.cpp | |
parent | 768127df473777d4272fb59948ac0c34a959f4ec (diff) | |
download | kconfig-5.61.0-rc2.tar.gz kconfig-5.61.0-rc2.tar.bz2 |
Security: remove support for $(...) in config keys with [$e] marker.v5.61.0-rc2v5.61.0
Summary:
It is very unclear at this point what a valid use case for this feature
would possibly be. The old documentation only mentions $(hostname) as
an example, which can be done with $HOSTNAME instead.
Note that $(...) is still supported in Exec lines of desktop files,
this does not require [$e] anyway (and actually works better without it,
otherwise the $ signs need to be doubled to obey kconfig $e escaping rules...).
Test Plan:
ctest passes; various testcases with $(...) in desktop files,
directory files, and config files, no longer execute commands.
Reviewers: mdawson, aacid, broulik, davidedmundson, kossebau, apol, sitter, security-team
Reviewed By: mdawson, davidedmundson
Subscribers: ZaWertun, rikmills, fvogt, ngraham, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D22979
(cherry picked from commit 5d3e71b1d2ecd2cb2f910036e614ffdfc895aa22)
Diffstat (limited to 'src/core/kconfig.cpp')
-rw-r--r-- | src/core/kconfig.cpp | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/src/core/kconfig.cpp b/src/core/kconfig.cpp index e1b11edd..f6824ce6 100644 --- a/src/core/kconfig.cpp +++ b/src/core/kconfig.cpp @@ -28,19 +28,6 @@ #include <cstdlib> #include <fcntl.h> -#ifdef _MSC_VER -static inline FILE *popen(const char *cmd, const char *mode) -{ - return _popen(cmd, mode); -} -static inline int pclose(FILE *stream) -{ - return _pclose(stream); -} -#else -#include <unistd.h> -#endif - #include "kconfigbackend_p.h" #include "kconfiggroup.h" @@ -183,29 +170,7 @@ QString KConfigPrivate::expandString(const QString &value) int nDollarPos = aValue.indexOf(QLatin1Char('$')); while (nDollarPos != -1 && nDollarPos + 1 < aValue.length()) { // there is at least one $ - if (aValue[nDollarPos + 1] == QLatin1Char('(')) { - int nEndPos = nDollarPos + 1; - // the next character is not $ - while ((nEndPos <= aValue.length()) && (aValue[nEndPos] != QLatin1Char(')'))) { - nEndPos++; - } - nEndPos++; - QString cmd = aValue.mid(nDollarPos + 2, nEndPos - nDollarPos - 3); - - QString result; - -// FIXME: wince does not have pipes -#ifndef _WIN32_WCE - FILE *fs = popen(QFile::encodeName(cmd).data(), "r"); - if (fs) { - QTextStream ts(fs, QIODevice::ReadOnly); - result = ts.readAll().trimmed(); - pclose(fs); - } -#endif - aValue.replace(nDollarPos, nEndPos - nDollarPos, result); - nDollarPos += result.length(); - } else if (aValue[nDollarPos + 1] != QLatin1Char('$')) { + if (aValue[nDollarPos + 1] != QLatin1Char('$')) { int nEndPos = nDollarPos + 1; // the next character is not $ QStringRef aVarName; |