Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbc8e78

Browse files
committed
CPP: Rearrange PotentiallyDangerousFunction.ql.
1 parent f47a77b commit bbc8e78

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

cpp/ql/src/Security/CWE/CWE-676/PotentiallyDangerousFunction.ql

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
*/
1212
import cpp
1313

14-
15-
predicate dangerousFunction(Function function) {
16-
exists (string name | name = function.getQualifiedName() |
17-
name = "gmtime")
14+
predicate potentiallyDangerousFunction(Function f, string message) {
15+
(
16+
f.getQualifiedName() = "gmtime" and
17+
message = "Call to gmtime is potentially dangerous"
18+
)
1819
}
1920

2021

21-
from FunctionCall call, Function target
22-
where call.getTarget() = target
23-
and dangerousFunction(target)
24-
select call, "Call to " + target.getQualifiedName() + " is potentially dangerous"
22+
from FunctionCall call, Function target, string message
23+
where
24+
call.getTarget() = target and
25+
potentiallyDangerousFunction(target, message)
26+
select call, message

0 commit comments

Comments
 (0)