From e8366292155187b7fa5455600deae2bc944b2ce1 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 5 Feb 2013 11:37:49 +0100 Subject: [PATCH] Bug fixes for search (safeStringFormat should not replace all if given scalar values) --- lib/core/common.py | 4 ++-- plugins/generic/search.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 097b7c864..1ae589399 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1374,9 +1374,9 @@ def safeStringFormat(format_, params): retVal = format_.replace("%d", "%s") if isinstance(params, basestring): - retVal = retVal.replace("%s", params) + retVal = retVal.replace("%s", params, 1) elif not isListLike(params): - retVal = retVal.replace("%s", str(params)) + retVal = retVal.replace("%s", str(params), 1) else: count, index = 0, 0 while index != -1: diff --git a/plugins/generic/search.py b/plugins/generic/search.py index 942057cde..6c9bdffbc 100644 --- a/plugins/generic/search.py +++ b/plugins/generic/search.py @@ -314,7 +314,7 @@ class Search: query = agent.limitQuery(index, query) foundTbl = unArrayizeValue(inject.getValue(query, union=False, error=False)) - if not isNoneValue(foundTbls[db]): + if not isNoneValue(foundTbl): kb.hintValue = foundTbl foundTbl = safeSQLIdentificatorNaming(foundTbl, True) foundTbls[db].append(foundTbl)