We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3183893 + 50c0ec1 commit b8ee5a6Copy full SHA for b8ee5a6
cpp/ql/src/Security/CWE/CWE-190/ArithmeticUncontrolled.ql
@@ -16,12 +16,19 @@ import semmle.code.cpp.security.Overflow
16
import semmle.code.cpp.security.Security
17
import semmle.code.cpp.security.TaintTracking
18
19
+predicate isRandCall(FunctionCall fc) { fc.getTarget().getName() = "rand" }
20
+
21
+predicate isRandCallOrParent(Expr e) {
22
+ isRandCall(e) or
23
+ isRandCallOrParent(e.getAChild())
24
+}
25
26
predicate isRandValue(Expr e) {
- e.(FunctionCall).getTarget().getName() = "rand"
27
+ isRandCall(e)
28
or
29
exists(MacroInvocation mi |
30
e = mi.getExpr() and
- e.getAChild*().(FunctionCall).getTarget().getName() = "rand"
31
+ isRandCallOrParent(e)
32
)
33
}
34
0 commit comments