File tree Expand file tree Collapse file tree
cpp/ql/src/experimental/Security/CWE/CWE-020 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import cpp
1616import semmle.code.cpp.valuenumbering.GlobalValueNumbering
1717
18- / * * Pridekat allows you to get the number of the argument used for positioning in the buffer by the name of the function . * /
18+ /** Holds for a function `f` that has an argument at index `apos` used for positioning in a buffer. */
1919predicate numberArgument ( Function f , int apos ) {
2020 f .hasGlobalOrStdName ( "write" ) and apos = 2
2121 or
@@ -54,7 +54,7 @@ class IfCompareWithZero extends IfStmt {
5454
5555from FunctionCall fc , IfCompareWithZero ifc , int na
5656where
57- numberArgument ( fc .getTarget ( ) , na )
57+ numberArgument ( fc .getTarget ( ) , na ) and
5858 globalValueNumber ( fc .getArgument ( na ) ) = globalValueNumber ( ifc .noZerroOperand ( ) ) and
5959 dominates ( fc , ifc ) and
6060 not exists ( IfStmt ifc1 |
You can’t perform that action at this time.
0 commit comments