@@ -44,34 +44,39 @@ predicate isStringCopyUsedInLogicalOperationOrCondition(FunctionCall func, Expr
4444 isStringComparisonFunction ( func .getTarget ( ) .getQualifiedName ( ) ) and
4545 (
4646 (
47- (
48- // it is being used in an equality or logical operation
49- exists ( EqualityOperation eop |
50- eop = expr1 and
51- func = eop .getAnOperand ( )
52- )
53- or
54- exists ( UnaryLogicalOperation ule |
55- expr1 = ule and
56- func = ule .getOperand ( )
57- )
58- or
59- exists ( BinaryLogicalOperation ble |
60- expr1 = ble and
61- func = ble .getAnOperand ( )
62- )
63- ) and
64- msg = "Return value of " + func .getTarget ( ) .getQualifiedName ( ) +
65- " used in a logical operation."
66- )
47+ // it is being used in an equality or logical operation
48+ exists ( EqualityOperation eop |
49+ eop = expr1 and
50+ func = eop .getAnOperand ( )
51+ )
52+ or
53+ exists ( UnaryLogicalOperation ule |
54+ expr1 = ule and
55+ func = ule .getOperand ( )
56+ )
57+ or
58+ exists ( BinaryLogicalOperation ble |
59+ expr1 = ble and
60+ func = ble .getAnOperand ( )
61+ )
62+ ) and
63+ msg = "Return value of " + func .getTarget ( ) .getQualifiedName ( ) +
64+ " used in a logical operation."
6765 or
68- exists ( ConditionalStmt condstmt |
69- // or the string copy function is used directly as the conditional expression
70- func = condstmt .getControllingExpr ( ) and
71- expr1 = func and
72- msg = "Return value of " + func .getTarget ( ) .getQualifiedName ( ) +
73- " used directly in a conditional expression."
74- )
66+ // or the string copy function is used directly as the conditional expression
67+ (
68+ exists ( ConditionalStmt condstmt |
69+ func = condstmt .getControllingExpr ( ) and
70+ expr1 = func
71+ )
72+ or
73+ exists ( ConditionalExpr ce |
74+ expr1 = ce and
75+ func = ce .getCondition ( )
76+ )
77+ ) and
78+ msg = "Return value of " + func .getTarget ( ) .getQualifiedName ( ) +
79+ " used directly in a conditional expression."
7580 )
7681}
7782
0 commit comments