Skip to content
OpenAdvisories

Weakness (CWE)

CWE-484: Omitted Break Statement in Switch

Base Draft

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.

How to prevent it (2 mitigations)
  1. Implementation

    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.

  2. Implementation

    The functionality of omitting a break statement could be clarified with an if statement. This method is much safer.

Source: MITRE CWE-484

1 result · Clear filters · Feed

  • Medium 4.4

    GraphQl securityAfterResolver not called

    API Platform Core is a system to create hypermedia-driven REST and GraphQL APIs. Starting in version 3.3.8, a security check that gets called after GraphQl resolvers is always replaced by another one as there's no break in a clause. As this falls back to `sec…