- Added bounds check before call to string::substr to avoid passing a
  negative start pos. Test rc.t was broken from commit 0ac9a4b because
  it contains 'report.:b' and legacyCheckForDeprecatedVariables was
  trying to substr starting from pos 'length() - 12' (-3).
This commit is contained in:
Owen Clarke 2012-03-06 23:32:24 +11:00
parent 507ee20f3b
commit 9951da5710

View file

@ -141,12 +141,14 @@ std::string legacyCheckForDeprecatedVariables ()
for (it = context.config.begin (); it != context.config.end (); ++it)
{
// report.*.limit
if (it->first.substr (0, 7) == "report." &&
if (it->first.length () > 13 &&
it->first.substr (0, 7) == "report." &&
it->first.substr (it->first.length () - 6) == ".limit")
deprecated.push_back (it->first);
// report.*.annotaitons
if (it->first.substr (0, 7) == "report." &&
if (it->first.length () > 19 &&
it->first.substr (0, 7) == "report." &&
it->first.substr (it->first.length () - 12) == ".annotations")
deprecated.push_back (it->first);