mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Take into account that the 4th argument of openat may be omitted
This matches what is done for `open`.
This commit is contained in:
@@ -111,12 +111,18 @@ class CreatCreationExpr extends FileCreationExpr {
|
||||
class OpenatCreationExpr extends FileCreationExpr {
|
||||
OpenatCreationExpr() {
|
||||
this.getTarget().getName() = "openat" and
|
||||
this.getNumberOfArguments() = 4
|
||||
sets(this.getArgument(2).getValue().toInt(), o_creat())
|
||||
}
|
||||
|
||||
override Expr getPath() { result = this.getArgument(1) }
|
||||
|
||||
override int getMode() { result = this.getArgument(3).getValue().toInt() }
|
||||
override int getMode() {
|
||||
if exists(this.getArgument(3))
|
||||
then result = this.getArgument(3).getValue().toInt()
|
||||
else
|
||||
// assume anything is permitted
|
||||
result = 0.bitNot()
|
||||
}
|
||||
}
|
||||
|
||||
private int fopenMode() {
|
||||
|
||||
Reference in New Issue
Block a user