CWE-462: Duplicate Key in Associative List (Alist)
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
Duplicate keys in associative lists can lead to non-unique keys being mistaken for an error.
扩展描述
A duplicate key entry -- if the alist is designed properly -- could be used as a constant time replace function. However, duplicate key entries could be inserted by mistake. Because of this ambiguity, duplicate key entries in an association list are not recommended and should not be allowed.
常见后果
影响范围: Other
技术影响: Quality Degradation Varies by Context
潜在缓解措施
阶段: Architecture and Design
描述: Use a hash table instead of an alist.
阶段: Architecture and Design
描述: Use an alist which checks the uniqueness of hash keys with each entry before inserting the entry.
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | - |
适用平台
编程语言
分类映射
| 分类名称 | 条目ID | 条目名称 | 映射适配度 |
|---|---|---|---|
| CLASP | - | Duplicate key in associative list (alist) | - |
| CERT C Secure Coding | ENV02-C | Beware of multiple environment variables with the same effective name | - |