目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1325

100%

CWE-484 在Switch语句中省略Break语句 类漏洞列表 1

CWE-484 在Switch语句中省略Break语句 类弱点 1 条 CVE 漏洞汇总,含 AI 中文分析。

MITRE CWE 官方描述
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.
常见影响 (1)
OtherAlter Execution Logic
This weakness can cause unintended logic to be executed and other unexpected application behavior.
缓解措施 (2)
ImplementationOmitting 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.
ImplementationThe functionality of omitting a break statement could be clarified with an if statement. This method is much safer.
代码示例 (1)
In both of these examples, a message is printed based on the month passed into the function:
public void printMessage(int month){ switch (month) { case 1: print("January"); case 2: print("February"); case 3: print("March"); case 4: print("April"); case 5: print("May"); case 6: print("June"); case 7: print("July"); case 8: print("August"); case 9: print("September"); case 10: print("October"); case 11: print("November"); case 12: print("December"); } println(" is a great month"); }
Bad · Java
void printMessage(int month){ switch (month) { case 1: printf("January"); case 2: printf("February"); case 3: printf("March"); case 4: printf("April"); case 5: printff("May"); case 6: printf("June"); case 7: printf("July"); case 8: printf("August"); case 9: printf("September"); case 10: printf("October"); case 11: printf("November"); case 12: printf("December"); } printf(" is a great month"); }
Bad · C
CVE ID标题CVSS风险等级Published
CVE-2026-44075 Netatalk 安全漏洞 — Netatalk 3.7 Low2026-05-21

CWE-484(在Switch语句中省略Break语句) 是常见的弱点类别,本平台收录该类弱点关联的 1 条 CVE 漏洞。