C++: QLDoc PrintfLike.qll.

This commit is contained in:
Geoffrey White
2020-06-25 15:28:27 +01:00
parent d526a10981
commit b7730fb1ad

View File

@@ -1,6 +1,18 @@
/**
* Provides a predicate for identifying formatting functions like `printf`.
*
* Consider using the newer model in
* `semmle.code.cpp.models.interfaces.FormattingFunction` directly instead of
* this library.
*/
import semmle.code.cpp.commons.Printf
import external.ExternalArtifact
/**
* Holds if `func` is a `printf`-like formatting function and `formatArg` is
* the index of the format string argument.
*/
predicate printfLikeFunction(Function func, int formatArg) {
formatArg = func.(FormattingFunction).getFormatParameterIndex() and
not func instanceof UserDefinedFormattingFunction