Ensure group is unescaped properly in kconf_update.

During a kconf_update run, an invalid group name may be treated as correct
even though the name failed to unescape.  This leads the group name to be
a null character, which will fail.

If the unescape failed, return that failure status instead.  This should have
no impact, as the previous result would have been wrong anyways.  Now a
more useful diagnostic will be returned instead.

Update the unit tests to ensure this issue is tested in the future.

Found in Coverity issue 258087.

REVIEW: 126556
wilder
Matthew Dawson 10 years ago
parent 837edaabc4
commit 55bf90ff78
  1. 6
      autotests/test_kconfigutils.cpp
  2. 2
      src/kconf_update/kconfigutils.cpp

@ -57,6 +57,12 @@ void TestKConfigUtils::testParseGroupString_data()
<< QStringList()
<< false
;
QTest::newRow("invalid-escape-string")
<< "[a\\z]"
<< QStringList()
<< false
;
}
void TestKConfigUtils::testParseGroupString()

@ -46,7 +46,7 @@ KConfigGroup openGroup(KConfig *config, const QStringList &lst)
QStringList parseGroupString(const QString &_str, bool *ok, QString *error)
{
QString str = unescapeString(_str.trimmed(), ok, error);
if (!ok) {
if (!*ok) {
return QStringList();
}

Loading…
Cancel
Save