CWE一覧に戻る
CWE-484

SwitchでのBreak文の省略

Omitted Break Statement in Switch
脆弱性 レビュー中
JA

この製品では、switchなどの構文の中でbreak文が省略され、複数の条件に関連するコードが実行されてしまう。これは、プログラマが1つの条件に関連するコードのみを実行するつもりだった場合に問題を引き起こす可能性があります。

これは、クリティカルなコードが実行すべきでない状況で実行されることにつながる。

EN

The product omits a break statement within a switch or similar construct, causing code associated with multiple conditions to execute. This can cause problems when the programmer only intended to execute code associated with one condition.

This can lead to critical code executing in situations where it should not.

Scope: Other / Impact: Alter Execution Logic
Omitting a break statement so that one may fall through is often indistinguishable from an error, and therefore should be avoided. If you need to use fall-through capabilities, make sure that you have clearly documented this within the switch statement, and ensure that you have examined all the logical possibilities.
The functionality of omitting a break statement could be clarified with an if statement. This method is much safer.
MITRE公式ページ — CWE-484