Skip to content

Commit

Permalink
lgtm: complain about ftok() use
Browse files Browse the repository at this point in the history
Triggered by systemd#11555
  • Loading branch information
poettering committed Mar 11, 2019
1 parent 194a096 commit fd541a5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .lgtm/cpp-queries/ftok.ql
@@ -0,0 +1,21 @@
/**
* @name Use of ftok()
* @description ftok() is unsafe to call. Use extract_first_word() instead.
* @kind problem
* @problem.severity error
* @precision high
* @id cpp/ftok
* @tags reliability
* security
*/
import cpp

predicate dangerousFunction(Function function) {
exists (string name | name = function.getQualifiedName() |
name = "ftok")
}

from FunctionCall call, Function target
where call.getTarget() = target
and dangerousFunction(target)
select call, target.getQualifiedName() + " is potentially dangerous"

0 comments on commit fd541a5

Please sign in to comment.