结构: Simple
Abstraction: Variant
状态: Draft
被利用可能性: unkown
The software contains an expression that will always evaluate to true.
cwe_Nature: ChildOf cwe_CWE_ID: 710 cwe_View_ID: 1000 cwe_Ordinal: Primary
cwe_Nature: CanPrecede cwe_CWE_ID: 561 cwe_View_ID: 1000
cwe_Nature: CanPrecede cwe_CWE_ID: 561 cwe_View_ID: 699
Language: {'cwe_Class': 'Language-Independent', 'cwe_Prevalence': 'Undetermined'}
范围 | 影响 | 注释 |
---|---|---|
Other | ['Quality Degradation', 'Varies by Context'] |
策略:
Use Static Analysis tools to spot such conditions.
In the following Java example the updateInventory() method used within an e-business product ordering/inventory application will check if the input product number is in the store or in the warehouse. If the product is found, the method will update the store or warehouse database as well as the aggregate product database. If the product is not found, the method intends to do some special processing without updating any database.
bad Java
However, the method never sets the isDelayed variable and instead will always update the isProductAvailable variable to true. The result is that the predicate testing the isProductAvailable boolean will always evaluate to true and therefore always update the product database. Further, since the isDelayed variable is initialized to false and never changed, the expression always evaluates to false and the customer will never be warned of a delay on their product.
映射的分类名 | ImNode ID | Fit | Mapped Node Name |
---|---|---|---|
CERT C Secure Coding | MSC00-C | Compile cleanly at high warning levels | |
Software Fault Patterns | SFP1 | Glitch in computation |