@@ -46,10 +46,16 @@ where
4646 fc .getTarget ( ) .hasGlobalOrStdName ( "tmpnam_r" )
4747 ) and
4848 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+ )
5359 ) and
5460 msg =
5561 "Finding the name of a file that does not exist does not mean that it will not be exist at the next operation."
9197 )
9298 ) and
9399 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+ )
97109 ) and
98110 msg =
99111 "Creating a file for writing without evaluating its existence and setting permissions can be unsafe."
0 commit comments