@@ -46,10 +46,16 @@ where
46
46
fc .getTarget ( ) .hasGlobalOrStdName ( "tmpnam_r" )
47
47
) and
48
48
not exists ( FunctionCall fctmp |
49
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "mktemp" ) or
50
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkstemp" ) or
51
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkstemps" ) or
52
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkdtemp" )
49
+ (
50
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "mktemp" ) or
51
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkstemp" ) or
52
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkstemps" ) or
53
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "mkdtemp" )
54
+ ) and
55
+ (
56
+ fc .getBasicBlock ( ) .getASuccessor * ( ) = fctmp .getBasicBlock ( ) or
57
+ fctmp .getBasicBlock ( ) .getASuccessor * ( ) = fc .getBasicBlock ( )
58
+ )
53
59
) and
54
60
msg =
55
61
"Finding the name of a file that does not exist does not mean that it will not be exist at the next operation."
91
97
)
92
98
) and
93
99
not exists ( FunctionCall fctmp |
94
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "umask" ) or
95
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "fchmod" ) or
96
- fctmp .getTarget ( ) .hasGlobalOrStdName ( "chmod" )
100
+ (
101
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "umask" ) or
102
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "fchmod" ) or
103
+ fctmp .getTarget ( ) .hasGlobalOrStdName ( "chmod" )
104
+ ) and
105
+ (
106
+ fc .getBasicBlock ( ) .getASuccessor * ( ) = fctmp .getBasicBlock ( ) or
107
+ fctmp .getBasicBlock ( ) .getASuccessor * ( ) = fc .getBasicBlock ( )
108
+ )
97
109
) and
98
110
msg =
99
111
"Creating a file for writing without evaluating its existence and setting permissions can be unsafe."
0 commit comments