This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit

Difference between revisions of "Code Correctness: Erroneous String Compare"

Jump to: navigation, search
Line 3: Line 3:
  #REDIRECT [[Failure to follow guideline/specification]]
  #REDIRECT [[Failure to follow guideline/specification]]
[[ASDR Table of Contents]]

Revision as of 23:25, 7 April 2009


#REDIRECT Failure to follow guideline/specification

Last revision (mm/dd/yy): 04/7/2009


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



The following branch will never be taken.

	  if (args[0] == STRING_CONSTANT) {"miracle");

Related Attacks

Related Vulnerabilities

Related Controls

Related Technical Impacts


Note: A reference to related CWE or CAPEC article should be added when exists. Eg: