Katalog CWE

CWE-482 · Słabość

Comparing instead of Assigning

Abstrakcja
Wariant
Status
Szkic
Ryzyko wykorzystania
niskie
Dodano
19 lipca 2006
Ostatnia zmiana
30 kwietnia 2026

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

Opis

The code uses an operator for comparison when the intention was to perform an assignment.

In many languages, the compare statement is very close in appearance to the assignment statement; they are often confused.

Skutki

  • Availability, Integrity

    Unexpected State

    The assignment will not take place, which should cause obvious program execution problems.

Zapobieganie

  • Testing

    Many IDEs and static analysis products will detect this problem.

Słabość nadrzędna

Kiedy powstaje

Dotyczy

C, C++

Źródła

  1. The CLASP Application Security Process — Secure Software, Inc., 2005
  2. The Art of Software Security Assessment — Mark Dowd, John McDonald, Justin Schuh, Chapter 6, "Typos", Page 289, Addison Wesley, 2006

Wpis z katalogu CWE 4.20.