Skip to content

Commit f37be68

Browse files
committed
C++: Handle builtin FormattingFunctions better
1 parent c5a082f commit f37be68

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cpp/ql/lib/semmle/code/cpp/models/interfaces/FormattingFunction.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ abstract class FormattingFunction extends ArrayFunction, TaintFunction {
4949
if this.hasDefinition()
5050
then firstFormatArgumentIndex = this.getDefinition().getNumberOfParameters()
5151
else
52-
forex(FunctionDeclarationEntry fde | fde = this.getAnExplicitDeclarationEntry() |
53-
firstFormatArgumentIndex = fde.getNumberOfParameters()
54-
)
52+
if this instanceof BuiltInFunction
53+
then firstFormatArgumentIndex = this.getNumberOfParameters()
54+
else
55+
forex(FunctionDeclarationEntry fde | fde = this.getAnExplicitDeclarationEntry() |
56+
firstFormatArgumentIndex = fde.getNumberOfParameters()
57+
)
5558
}
5659

5760
/** Gets the position at which the format parameter occurs. */

0 commit comments

Comments
 (0)