@@ -40,7 +40,7 @@ predicate numberArgumentModFunctions(Function f, int apos) {
40
40
f .hasGlobalOrStdName ( "chmod" ) and apos = 1
41
41
}
42
42
43
- from FunctionCall fc , string msg
43
+ from FunctionCall fc , string msg , FunctionCall fcsnd
44
44
where
45
45
fc .getTarget ( ) .hasGlobalOrStdName ( "umask" ) and
46
46
fc .getArgument ( 0 ) .getValue ( ) = "0" and
@@ -54,13 +54,14 @@ where
54
54
fctmp .getTarget ( ) .hasGlobalOrStdName ( "open" )
55
55
) and
56
56
fctmp .getNumberOfArguments ( ) = 2 and
57
- not fctmp .getArgument ( 0 ) .getValue ( ) = "/dev/null"
57
+ not fctmp .getArgument ( 0 ) .getValue ( ) = "/dev/null" and
58
+ fcsnd = fctmp
58
59
) and
59
60
not exists ( FunctionCall fctmp |
60
61
fctmp .getTarget ( ) .hasGlobalOrStdName ( "chmod" ) or
61
62
fctmp .getTarget ( ) .hasGlobalOrStdName ( "fchmod" )
62
63
) and
63
- msg = "Using umask (0) may not be safe."
64
+ msg = "Using umask(0) may not be safe with call $@ ."
64
65
or
65
66
fc .getTarget ( ) .hasGlobalOrStdName ( "umask" ) and
66
67
exists ( FunctionCall fctmp |
@@ -72,12 +73,14 @@ where
72
73
globalValueNumber ( fc .getArgument ( 0 ) ) = globalValueNumber ( fctmp .getArgument ( 1 ) ) and
73
74
fc .getArgument ( 0 ) .getValue ( ) != "0"
74
75
) and
75
- msg = "not use equal argument in umask and " + fctmp .getTarget ( ) .getName ( ) + " functions"
76
+ msg = "Not use equal argument in umask and $@ functions." and
77
+ fcsnd = fctmp
76
78
)
77
79
or
78
80
exists ( ContainsArithmetic exptmp , int i |
79
81
numberArgumentModFunctions ( fc .getTarget ( ) , i ) and
80
82
globalValueNumber ( exptmp ) = globalValueNumber ( fc .getArgument ( i ) ) and
81
- msg = "Using arithmetic to compute the mask may not be safe."
83
+ msg = "Using arithmetic to compute the mask in $@ may not be safe." and
84
+ fcsnd = fc
82
85
)
83
- select fc , msg
86
+ select fc , msg , fcsnd , fcsnd . getTarget ( ) . getName ( )
0 commit comments