CWE - 478 : Missing Default Case in Switch Statement
|
CWE Definition
|
http://cwe.mitre.org/data/definitions/478.html
|
|
Number of vulnerabilities:
|
0
|
|
Description
|
The code does not have a default case in a switch statement,
which might lead to complex logical errors and resultant
weaknesses. |
|
Background Details
|
|
|
Other Notes
|
This flaw represents a common problem in software development, in which
not all possible values for a variable are considered or handled by a given
process. Because of this, further decisions are made based on poor
information, and cascading failure results. This cascading failure may
result in any number of security issues, and constitutes a significant
failure in the system. In the case of switch style statements, the very
simple act of creating a default case can mitigate this situation, if done
correctly. Often however, the default cause is used simply to represent an
assumed option, as opposed to working as a sanity check. This is poor
practice and in some cases is as bad as omitting a default case entirely. |
|
|
Warning! CWE definitions are provided as a quick reference. They are
not complete and may not be up to date!
You must visit
http://cwe.mitre.org/ for a complete list of CWE entries
and for more details.