We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be0c26f commit 92f5a5fCopy full SHA for 92f5a5f
1 file changed
cpp/ql/src/experimental/Security/CWE/CWE-266/IncorrectPrivilegeAssignment.ql
@@ -53,7 +53,13 @@ where
53
fctmp.getTarget().hasGlobalOrStdName("fopen") or
54
fctmp.getTarget().hasGlobalOrStdName("open")
55
) and
56
- not fctmp.getArgument(1).getValue().matches("r%") and
+ (
57
+ fctmp.getArgument(1).getValue().matches("%a%") or
58
+ // unfortunately cannot use numeric value here because // O_APPEND is defined differently on different OSes:
59
+ // https://github.com/red/red/blob/92feb0c0d5f91e087ab35fface6906afbf99b603/runtime/definitions.reds#L477-L491
60
+ // this may introduce false negatives
61
+ fctmp.getArgument(1).getValueText().matches("%O_APPEND%")
62
+ ) and
63
fctmp.getNumberOfArguments() = 2 and
64
not fctmp.getArgument(0).getValue() = "/dev/null" and
65
fcsnd = fctmp
0 commit comments