The analyzer has detected a call function of the following kind:
This code may probably contain an error. For example, an incorrect variable name is used because of a misprint. The correct code should look like this then:
or like this:
Let's see how such misprints may affect the code in real life. Here's a fragment from a real application:
CXMLAttribute* pAttr1 = m_pXML->GetAttribute(CXMLAttribute::schemaName); CXMLAttribute* pAttr2 = pXML->GetAttribute(CXMLAttribute::schemaName); if ( pAttr1 && pAttr2 && !pAttr1->GetValue().CompareNoCase(pAttr1->GetValue())) ....
This code should compare two attributes. But a misprint causes the value "pAttr1->GetValue()" to be compared to itself.
This is the fixed code:
if ( pAttr1 && pAttr2 && !pAttr1->GetValue().CompareNoCase(pAttr2->GetValue()))
According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-688.
You can look at examples of errors detected by the V678 diagnostic.