diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2019-08-08 02:45:03 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2019-08-09 02:34:55 +0200 |
commit | f41c1bba8b7221acf2f226ab7249057f1d9559b5 (patch) | |
tree | 21f86b4319dd0a0006f2610798f8cbcdcdf02399 | |
parent | 3888dcd3dbefe399a6374e59c331c442fb984e0f (diff) | |
download | tdelibs-f41c1bba8b7221acf2f226ab7249057f1d9559b5.tar.gz tdelibs-f41c1bba8b7221acf2f226ab7249057f1d9559b5.zip |
Security: remove support for $(...) in config keys with [$e] marker.
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...).
Based on KDE Frameworks 5 kconfig patch for CVE-2019-14744.
This resolves issue #45.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 1074eb033654bd5462677ffe694eda7805390284)
-rw-r--r-- | kdecore/README.kiosk | 12 | ||||
-rw-r--r-- | kdecore/kconfigbase.cpp | 21 |
2 files changed, 1 insertions, 32 deletions
diff --git a/kdecore/README.kiosk b/kdecore/README.kiosk index 0cdadc9a9..6fc1c4983 100644 --- a/kdecore/README.kiosk +++ b/kdecore/README.kiosk @@ -642,18 +642,6 @@ The following syntax is also supported: Name[$ei]=${USER} -Shell Commands in KDE config files. -=================================== - -In KDE3.1 arbitrary entries in configuration files can contain shell -commands. This way the value of a configuration entry can be determined -dynamically at runtime. In order to use this the entry must be marked -with [$e]. - -Example: -Host[$e]=$(hostname) - - KDE3 Kiosk Application API ========================== diff --git a/kdecore/kconfigbase.cpp b/kdecore/kconfigbase.cpp index c5c0a4e25..add2d6a6d 100644 --- a/kdecore/kconfigbase.cpp +++ b/kdecore/kconfigbase.cpp @@ -276,26 +276,7 @@ TQString KConfigBase::readEntry( const char *pKey, while( nDollarPos != -1 && nDollarPos+1 < static_cast<int>(aValue.length())) { // there is at least one $ - if( (aValue)[nDollarPos+1] == '(' ) { - uint nEndPos = nDollarPos+1; - // the next character is no $ - while ( (nEndPos <= aValue.length()) && (aValue[nEndPos]!=')') ) - nEndPos++; - nEndPos++; - TQString cmd = aValue.mid( nDollarPos+2, nEndPos-nDollarPos-3 ); - - TQString result; - FILE *fs = popen(TQFile::encodeName(cmd).data(), "r"); - if (fs) - { - { - TQTextStream ts(fs, IO_ReadOnly); - result = ts.read().stripWhiteSpace(); - } - pclose(fs); - } - aValue.replace( nDollarPos, nEndPos-nDollarPos, result ); - } else if( (aValue)[nDollarPos+1] != '$' ) { + if( (aValue)[nDollarPos+1] != '$' ) { uint nEndPos = nDollarPos+1; // the next character is no $ TQString aVarName; |