File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
cpp/ql/src/Security/CWE/CWE-732 Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -111,12 +111,18 @@ class CreatCreationExpr extends FileCreationExpr {
111
111
class OpenatCreationExpr extends FileCreationExpr {
112
112
OpenatCreationExpr ( ) {
113
113
this .getTarget ( ) .getName ( ) = "openat" and
114
- this .getNumberOfArguments ( ) = 4
114
+ sets ( this .getArgument ( 2 ) . getValue ( ) . toInt ( ) , o_creat ( ) )
115
115
}
116
116
117
117
override Expr getPath ( ) { result = this .getArgument ( 1 ) }
118
118
119
- override int getMode ( ) { result = this .getArgument ( 3 ) .getValue ( ) .toInt ( ) }
119
+ override int getMode ( ) {
120
+ if exists ( this .getArgument ( 3 ) )
121
+ then result = this .getArgument ( 3 ) .getValue ( ) .toInt ( )
122
+ else
123
+ // assume anything is permitted
124
+ result = 0 .bitNot ( )
125
+ }
120
126
}
121
127
122
128
private int fopenMode ( ) {
You can’t perform that action at this time.
0 commit comments