This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "Code Correctness: Erroneous String Compare"
From OWASP
(Reverting to last version not containing links to www.textriclisitd.com) |
|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | {{ | + | {{template:CandidateForDeletion}} |
| − | |||
| − | + | #REDIRECT [[Failure to follow guideline/specification]] | |
| − | |||
| − | |||
| − | |||
| + | Last revision (mm/dd/yy): '''{{REVISIONMONTH}}/{{REVISIONDAY}}/{{REVISIONYEAR}}''' | ||
==Description== | ==Description== | ||
| Line 40: | Line 37: | ||
* [[Vulnerability 1]] | * [[Vulnerability 1]] | ||
* [[Vulnerabiltiy 2]] | * [[Vulnerabiltiy 2]] | ||
| − | |||
| − | |||
| Line 48: | Line 43: | ||
* [[Control 1]] | * [[Control 1]] | ||
* [[Control 2]] | * [[Control 2]] | ||
| − | |||
| − | |||
| − | |||
==Related [[Technical Impacts]]== | ==Related [[Technical Impacts]]== | ||
| Line 64: | 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] | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 18:29, 27 May 2009
#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: