CWE-482 · Słabość
Comparing instead of Assigning
- Abstrakcja
- Wariant
- Status
- Szkic
- Ryzyko wykorzystania
- niskie
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 30 kwietnia 2026
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
- Implementation — This bug primarily originates from a typo.
Dotyczy
C, C++
Źródła
- The CLASP Application Security Process — Secure Software, Inc., 2005
- 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.