Skip to content

Commit 8765c33

Browse files
committed
C++: Also check the number of parameters to keep the tests happy.
1 parent 615c805 commit 8765c33

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
1919
import TaintedWithPath
2020

2121
predicate isUnboundedRandCall(FunctionCall fc) {
22-
fc.getTarget().hasGlobalOrStdOrBslName("rand") and not bounded(fc)
22+
exists(Function func | func = fc.getTarget() |
23+
func.hasGlobalOrStdOrBslName("rand") and
24+
not bounded(fc) and
25+
func.getNumberOfParameters() = 0
26+
)
2327
}
2428

2529
/**

0 commit comments

Comments
 (0)