Code Correctness: Erroneous String Compare

ASDR Table of Contents

Last revision (mm/dd/yy): //

Description
Strings should be compared with the equals method, not == or !=.

This program uses == or != to compare two strings for equality, which compares two objects for equality, not their values. Chances are good that the two references will never be equal.

Risk Factors
TBD

Examples
The following branch will never be taken.

if (args[0] == STRING_CONSTANT) { logger.info("miracle"); }

Related Attacks

 * Attack 1
 * Attack 2

Related Vulnerabilities

 * Vulnerability 1
 * Vulnerabiltiy 2

Related Controls

 * Control 1
 * Control 2

Related Technical Impacts

 * Technical Impact 1
 * Technical Impact 2