1 vulnerabilities classified as CWE-478 (在Switch语句中缺失缺省条件). AI Chinese analysis included.
CWE-478 represents a logic error weakness occurring when a multiple-condition expression, such as a switch statement, lacks a default case to handle unanticipated input values. This omission typically leads to undefined behavior or silent failures, as the program proceeds with uninitialized or incorrect state data rather than explicitly managing unexpected scenarios. Attackers rarely exploit this directly as a vulnerability but may trigger it to cause denial of service or induce logical errors that facilitate further attacks, such as privilege escalation or data corruption. Developers prevent this weakness by ensuring comprehensive input validation and always including a default case in conditional structures. This practice guarantees that all possible execution paths are accounted for, forcing the application to handle unexpected inputs gracefully and maintain system integrity under unforeseen conditions.
#define FAILED 0 #define PASSED 1 int result; ... result = security_check(data); switch (result) { case FAILED: printf("Security check failed!\n"); exit(-1); //Break never reached because of exit() break; case PASSED: printf("Security check passed.\n"); break; } // program execution continues... ...#define FAILED 0 #define PASSED 1 int result; ... result = security_check(data); switch (result) { case FAILED: printf("Security check failed!\n"); exit(-1); //Break never reached because of exit() break; case PASSED: printf("Security check passed.\n"); break; default: printf("Unknown error (%d), exiting...\n",result); exit(-1); }public static final String INTEREST_RATE_AT_ZERO_POINTS = "5.00"; public static final String INTEREST_RATE_AT_ONE_POINTS = "4.75"; public static final String INTEREST_RATE_AT_TWO_POINTS = "4.50"; ... public BigDecimal getInterestRate(int points) { BigDecimal result = new BigDecimal(INTEREST_RATE_AT_ZERO_POINTS); switch (points) { case 0: result = new BigDecimal(INTEREST_RATE_AT_ZERO_POINTS); break; case 1: result = new BigDecimal(INTEREST_RATE_AT_ONE_POINTS); break; case 2: result = new BigDecimal(INTEREST_RATE_AT_TWO_POINTS); break; } return result; }public static final String INTEREST_RATE_AT_ZERO_POINTS = "5.00"; public static final String INTEREST_RATE_AT_ONE_POINTS = "4.75"; public static final String INTEREST_RATE_AT_TWO_POINTS = "4.50"; ... public BigDecimal getInterestRate(int points) { BigDecimal result = new BigDecimal(INTEREST_RATE_AT_ZERO_POINTS); switch (points) { case 0: result = new BigDecimal(INTEREST_RATE_AT_ZERO_POINTS); break; case 1: result = new BigDecimal(INTEREST_RATE_AT_ONE_POINTS); break; case 2: result = new BigDecimal(INTEREST_RATE_AT_TWO_POINTS); break; default: System.err.println("Invalid value for points, must | CVE ID | Title | CVSS | Severity | Published |
|---|---|---|---|---|
| CVE-2026-33064 | free5GC UDM DataChangeNotification Procedure Panic Due to Nil Pointer Dereference — free5gc | 7.5 | - | 2026-03-20 |
Vulnerabilities classified as CWE-478 (在Switch语句中缺失缺省条件) represent 1 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.