mirror of
https://github.com/github/codeql.git
synced 2025-12-21 03:06:31 +01:00
C++: QLDoc PrintfLike.qll.
This commit is contained in:
@@ -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 semmle.code.cpp.commons.Printf
|
||||||
import external.ExternalArtifact
|
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) {
|
predicate printfLikeFunction(Function func, int formatArg) {
|
||||||
formatArg = func.(FormattingFunction).getFormatParameterIndex() and
|
formatArg = func.(FormattingFunction).getFormatParameterIndex() and
|
||||||
not func instanceof UserDefinedFormattingFunction
|
not func instanceof UserDefinedFormattingFunction
|
||||||
|
|||||||
Reference in New Issue
Block a user