CWE一覧に戻る
CWE-462

連想リスト(Alist)の重複キー

Duplicate Key in Associative List (Alist)
脆弱性 作成中
JA

連想リストのキーが重複していると、一意でないキーをエラーと勘違いしてしまうことがある。

重複したキー・エントリーは、もしアリストが適切に設計されていれば、一定時間の置換関数として使うことができる。しかし、重複するキー項目が誤って挿入される可能性もある。このような曖昧さがあるため、アソシエーショ ンリストの重複キー項目は推奨されないし、許可されるべきではない。

EN

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.

Scope: Other / Impact: Quality Degradation; Varies by Context
Use a hash table instead of an alist.
Use an alist which checks the uniqueness of hash keys with each entry before inserting the entry.
MITRE公式ページ — CWE-462