Errors in C, C++, and other programming languages often Software vulnerabilities can result when a programmer fails to consider all possible data states.
Non-Compliant Code Example
...
This non-compliant code example fails to consider all possible cases. This may be the correct behavior in this case, but failure to account for all the values of widget_type
may result in logic errors if widget_type
unexpectedly assumes a different value. This is particularly problematic in C, because an identifier declared as an enumeration constant has type int
. Therefore, a programmer can accidently accidentally assign an arbitrary integer value to an enum
type as shown in this example.
...