Skip to content

Commit bb3616e

Browse files
committed
C++: Add example for globalVarFromId
1 parent 9a55d42 commit bb3616e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,14 @@ predicate taintedIncludingGlobalVars(Expr source, Element tainted, string global
400400

401401
/**
402402
* Gets the global variable whose qualified name is `id`. Use this predicate
403-
* together with `taintedIncludingGlobalVars`.
403+
* together with `taintedIncludingGlobalVars`. Example:
404+
*
405+
* ```
406+
* exists(string varName |
407+
* taintedIncludingGlobalVars(source, tainted, varName) and
408+
* var = globalVarFromId(varName)
409+
* )
410+
* ```
404411
*/
405412
GlobalOrNamespaceVariable globalVarFromId(string id) { id = result.getQualifiedName() }
406413

0 commit comments

Comments
 (0)