Skip to content

Commit d1c8956

Browse files
authored
Apply suggestions from code review
1 parent 92f5a5f commit d1c8956

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-266/IncorrectPrivilegeAssignment.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ where
5555
) and
5656
(
5757
fctmp.getArgument(1).getValue().matches("%a%") or
58+
fctmp.getArgument(1).getValue().matches("%w%") or
5859
// unfortunately cannot use numeric value here because // O_APPEND is defined differently on different OSes:
5960
// https://github.com/red/red/blob/92feb0c0d5f91e087ab35fface6906afbf99b603/runtime/definitions.reds#L477-L491
6061
// this may introduce false negatives
61-
fctmp.getArgument(1).getValueText().matches("%O_APPEND%")
62+
fctmp.getArgument(1).(BitwiseOrExpr).getAChild*().getValueText().matches("O_CREAT")
6263
) and
6364
fctmp.getNumberOfArguments() = 2 and
6465
not fctmp.getArgument(0).getValue() = "/dev/null" and

0 commit comments

Comments
 (0)