Difference between revisions of "Using the wrong operator"

From OWASP
Jump to: navigation, search
(Description)
(Related Controls)
Line 68: Line 68:
  
 
* Pre-design through Build: Most static analysis programs should be able to catch these errors.
 
* Pre-design through Build: Most static analysis programs should be able to catch these errors.
* 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 "walk" from one pointer to the other and calculate the difference. Always sanity check this number.
+
* 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. Using this variable, "walk" from one pointer to the other and calculate the difference. Always sanity check this number.
 
+
  
 
==Related [[Technical Impacts]]==
 
==Related [[Technical Impacts]]==

Revision as of 09:00, 1 March 2009

This is a Vulnerability. To view all vulnerabilities, please see the Vulnerability Category page.



Last revision (mm/dd/yy): 03/1/2009

Vulnerabilities Table of Contents

Description

This is a common error given when an operator is used which does not make sense in context.

Consequences

Unspecified.

Exposure period

  • Pre-design through Build: The use of tools to detect this problem is recommended.
  • Implementation: Many logic errors can lead to this condition. It can be exacerbated by lack, of or misuse, of mitigating technologies.

Platform

  • Languages: Any
  • Operating platforms: Any

Required resources

Any

Severity

Medium

Likelihood of exploit

Low

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.

Risk Factors

TBD


Examples

In C:

char foo;
foo=a+c;


Related Attacks


Related Vulnerabilities


Related Controls

  • Pre-design through Build: Most static analysis programs should be able to catch these errors.
  • 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. Using this variable, "walk" from one pointer to the other and calculate the difference. Always sanity check this number.

Related Technical Impacts


References

TBD