1 vulnerabilities classified as CWE-570 (表达式永假). AI Chinese analysis included.
CWE-570 represents a logical error weakness where a conditional expression is statically determined to always evaluate to false, rendering the associated code path unreachable. This flaw typically arises from incorrect operator usage, such as confusing equality with assignment, or from outdated logic that fails to account for updated variable states or data types. While not directly exploitable for remote code execution, it undermines software integrity by creating dead code that obscures the intended control flow, potentially hiding security vulnerabilities or causing unexpected behavior during maintenance. Developers avoid this weakness by employing static analysis tools to detect unreachable branches, utilizing compiler warnings for suspicious comparisons, and rigorously reviewing conditional logic during code reviews to ensure expressions accurately reflect the intended business rules and data constraints.
public void updateUserAccountOrder(String productNumber, String accountNumber) { boolean isValidProduct = false; boolean isValidAccount = false; if (validProductNumber(productNumber)) { isValidProduct = true; updateInventory(productNumber); } else { return; } if (validAccountNumber(accountNumber)) { isValidProduct = true; updateAccount(accountNumber, productNumber); } if (isValidProduct && isValidAccount) { updateAccountOrder(accountNumber, productNumber); } }... if (validAccountNumber(accountNumber)) { isValidAccount = true; updateAccount(accountNumber, productNumber); } ...#define BIT_READ 0x0001 // 00000001 #define BIT_WRITE 0x0010 // 00010000 unsigned int mask = BIT_READ & BIT_WRITE; /* intended to use "|" */ // using "&", mask = 00000000 // using "|", mask = 00010001 // determine if user has read and write access int hasReadWriteAccess(unsigned int userMask) { // if the userMask has read and write bits set // then return 1 (true) if (userMask & mask) { return 1; } // otherwise return 0 (false) return 0; }| CVE ID | Title | CVSS | Severity | Published |
|---|---|---|---|---|
| CVE-2024-32633 | Unsigned compared against 0 — Falcon/Crane | 4.0 | Medium | 2024-04-16 |
Vulnerabilities classified as CWE-570 (表达式永假) represent 1 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.