mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Limit open/openat target to global/std scope
This commit is contained in:
@@ -134,7 +134,7 @@ abstract class FileCreationWithOptionalModeExpr extends FileCreationExpr {
|
||||
|
||||
class OpenCreationExpr extends FileCreationWithOptionalModeExpr {
|
||||
OpenCreationExpr() {
|
||||
this.getTarget().getName() = ["open", "_open", "_wopen"] and
|
||||
this.getTarget().hasGlobalOrStdName(["open", "_open", "_wopen"]) and
|
||||
exists(int flag | flag = this.getArgument(1).getValue().toInt() |
|
||||
setsFlag(flag, o_creat()) or setsFlag(flag, o_tmpfile())
|
||||
)
|
||||
@@ -163,7 +163,7 @@ class CreatCreationExpr extends FileCreationExpr {
|
||||
|
||||
class OpenatCreationExpr extends FileCreationWithOptionalModeExpr {
|
||||
OpenatCreationExpr() {
|
||||
this.getTarget().getName() = "openat" and
|
||||
this.getTarget().hasGlobalOrStdName("openat") and
|
||||
exists(int flag | flag = this.getArgument(2).getValue().toInt() |
|
||||
setsFlag(flag, o_creat()) or setsFlag(flag, o_tmpfile())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user