Katalog CWE

CWE-462 · Słabość

Duplicate Key in Associative List (Alist)

Abstrakcja
Wariant
Status
Niekompletny
Ryzyko wykorzystania
niskie
Dodano
19 lipca 2006
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

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.

Skutki

  • Other

    Quality Degradation; Varies by Context

Zapobieganie

  • 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.

Słabość nadrzędna

Kiedy powstaje

Dotyczy

C, C++, Java, C#

Źródła

  1. The CLASP Application Security Process — Secure Software, Inc., 2005

Wpis z katalogu CWE 4.20.