File tree Expand file tree Collapse file tree
cpp/ql/src/Likely Bugs/Likely Typos Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,31 +33,11 @@ predicate isBoolean( Expr e1 )
3333 )
3434}
3535
36- class StringCopyToBooleanConfiguration extends DataFlow:: Configuration {
37- StringCopyToBooleanConfiguration ( ) {
38- this = "StringCopyToBooleanConfiguration"
39- }
40-
41- override predicate isSource ( DataFlow:: Node source ) {
42- exists ( FunctionCall func |
43- func = source .asExpr ( )
44- and isStringComparisonFunction ( func .getTarget ( ) .getQualifiedName ( ) )
45- )
46- }
47-
48- override predicate isSink ( DataFlow:: Node sink ) {
49- exists ( Expr expr1 |
50- expr1 = sink .asExpr ( )
51- and isBoolean ( expr1 .getConversion * ( ) )
52- )
53- }
54- }
55-
5636predicate isStringCopyCastedAsBoolean ( FunctionCall func , Expr expr1 , string msg ) {
57- exists ( StringCopyToBooleanConfiguration modeConfig |
58- modeConfig . hasFlow ( DataFlow :: exprNode ( func ) , DataFlow :: exprNode ( expr1 ) )
59- and msg = "Return Value of " + func .getTarget ( ) .getQualifiedName ( ) + " used as boolean."
60- )
37+ DataFlow :: localFlow ( DataFlow :: exprNode ( func ) , DataFlow :: exprNode ( expr1 ) )
38+ and isBoolean ( expr1 . getConversion * ( ) )
39+ and isStringComparisonFunction ( func .getTarget ( ) .getQualifiedName ( ) )
40+ and msg = "Return Value of " + func . getTarget ( ) . getQualifiedName ( ) + " used as boolean."
6141}
6242
6343predicate isStringCopyUsedInCondition ( FunctionCall func , Expr expr1 , string msg ) {
You can’t perform that action at this time.
0 commit comments