mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
27 lines
727 B
Plaintext
27 lines
727 B
Plaintext
/**
|
|
* @name Use of potentially dangerous function
|
|
* @description Use of a standard library function that is not thread-safe.
|
|
* @kind problem
|
|
* @problem.severity warning
|
|
* @precision high
|
|
* @id cpp/potentially-dangerous-function
|
|
* @tags reliability
|
|
* security
|
|
* external/cwe/cwe-676
|
|
*/
|
|
|
|
import cpp
|
|
|
|
predicate potentiallyDangerousFunction(Function f, string message) {
|
|
exists(string name | f.hasGlobalName(name) |
|
|
name = ["gmtime", "localtime", "ctime", "asctime"] and
|
|
message = "Call to " + name + " is potentially dangerous"
|
|
)
|
|
}
|
|
|
|
from FunctionCall call, Function target, string message
|
|
where
|
|
call.getTarget() = target and
|
|
potentiallyDangerousFunction(target, message)
|
|
select call, message
|