mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
C++: Fix false positive
This commit is contained in:
@@ -65,7 +65,8 @@ class BooleanControllingAssignmentInStmt extends BooleanControllingAssignment {
|
||||
*/
|
||||
predicate candidateResult(BooleanControllingAssignment ae) {
|
||||
ae.getRValue().isConstant() and
|
||||
not ae.isWhitelisted()
|
||||
not ae.isWhitelisted() and
|
||||
not ae.getRValue() instanceof StringLiteral
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,4 +14,3 @@
|
||||
| test.cpp:84:7:84:11 | ... = ... | Use of '=' where '==' may have been intended. |
|
||||
| test.cpp:92:17:92:22 | ... = ... | Use of '=' where '==' may have been intended. |
|
||||
| test.cpp:113:6:113:10 | ... = ... | Use of '=' where '==' may have been intended. |
|
||||
| test.cpp:124:6:124:15 | ... = ... | Use of '=' where '==' may have been intended. |
|
||||
|
||||
@@ -121,6 +121,6 @@ void f() {
|
||||
void f2() {
|
||||
const char* sz = "abc";
|
||||
|
||||
if(sz = "def") { // GOOD [FALSE POSITIVE]: a == comparison with a string literal is probably not the intent here
|
||||
if(sz = "def") { // GOOD: a == comparison with a string literal is probably not the intent here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user