Use of Incorrect Operator |
Weakness ID: 480 (Weakness Base) | Status: Draft |
Description Summary
The programmer accidentally uses the wrong operator, which changes the application logic in security-relevant ways.
Pre-design through Build: Most static analysis programs should be able to catch these errors. |
Phase: Implementation Save an index variable. This is the recommended solution. Rather than subtract pointers from one another, use an index variable of the same size as the pointers in question. Use this variable to "walk" from one pointer to the other and calculate the difference. Always sanity check this number. |
These types of bugs generally are the result of a typo. Although most of them can easily be found when testing of the program, it is important that one correct these problems, since they almost certainly will break the code. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 569 | Expression Issues | Development Concepts (primary)699 |
ChildOf | ![]() | 670 | Always-Incorrect Control Flow Implementation | Research Concepts (primary)1000 |
ChildOf | ![]() | 747 | CERT C Secure Coding Section 49 - Miscellaneous (MSC) | Weaknesses Addressed by the CERT C Secure Coding Standard (primary)734 |
ParentOf | ![]() | 481 | Assigning instead of Comparing | Development Concepts699 Research Concepts (primary)1000 |
ParentOf | ![]() | 482 | Comparing instead of Assigning | Development Concepts699 Research Concepts (primary)1000 |
ParentOf | ![]() | 597 | Use of Wrong Operator in String Comparison | Development Concepts699 Research Concepts1000 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
CLASP | Using the wrong operator | ||
CERT C Secure Coding | MSC02-C | Avoid errors of omission | |
CERT C Secure Coding | MSC03-C | Avoid errors of addition |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
CLASP | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Applicable Platforms, Relationships, Other Notes, Taxonomy Mappings | ||||
2008-10-14 | CWE Content Team | MITRE | Internal | |
updated Relationships | ||||
2008-11-24 | CWE Content Team | MITRE | Internal | |
updated Relationships, Taxonomy Mappings | ||||
Previous Entry Names | ||||
Change Date | Previous Entry Name | |||
2008-04-11 | Using the Wrong Operator | |||