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

From OWASP
Jump to: navigation, search
(Reverting to last version not containing links to www.textriclisitd.com)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:Vulnerability}}
+
{{template:CandidateForDeletion}}
{{Template:Fortify}}
 
  
__TOC__
+
#REDIRECT [[Failure to follow guideline/specification]]
  
[[ASDR Table of Contents]]
 
  
  
Line 58: Line 56:
 
* http://www.link1.com
 
* http://www.link1.com
 
* [http://www.link2.com Title for the link2]
 
* [http://www.link2.com Title for the link2]
 
[[Category:FIXME|add links
 
 
In addition, one should classify vulnerability based on the following subcategories: Ex:<nowiki>[[Category:Error Handling Vulnerability]]</nowiki>
 
 
Availability Vulnerability
 
 
Authorization Vulnerability
 
 
Authentication Vulnerability
 
 
Concurrency Vulnerability
 
 
Configuration Vulnerability
 
 
Cryptographic Vulnerability
 
 
Encoding Vulnerability
 
 
Error Handling Vulnerability
 
 
Input Validation Vulnerability
 
 
Logging and Auditing Vulnerability
 
 
Session Management Vulnerability]]
 
 
__NOTOC__
 
 
 
[[Category:OWASP ASDR Project]]
 
[[Category:Code Quality Vulnerability]]
 
[[Category:C]]
 
[[Category:Implementation]]
 
[[Category:Code Snippet]]
 
[[Category:Vulnerability]]
 

Latest revision as of 18:29, 27 May 2009

Template:CandidateForDeletion

#REDIRECT Failure to follow guideline/specification


Last revision (mm/dd/yy): 05/27/2009

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


Related Vulnerabilities


Related Controls

Related Technical Impacts


References

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