CWE-468 · Słabość
Incorrect Pointer Scaling
- Abstrakcja
- Bazowa
- Status
- Niekompletny
- Ryzyko wykorzystania
- średnie
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
In C and C++, one may often accidentally refer to the wrong memory due to the semantics of when math operations are implicitly scaled.
Skutki
Confidentiality, Integrity
Read Memory; Modify Memory
Incorrect pointer scaling will often result in buffer overflow conditions. Confidentiality can be compromised if the weakness is in the context of a buffer over-read or under-read.
Zapobieganie
Architecture and Design
Use a platform with high-level memory abstractions.
Implementation
Always use array indexing instead of direct pointer manipulation.
Architecture and Design
Use technologies for preventing buffer overflows.
Słabość nadrzędna
Kiedy powstaje
- Implementation — Programmers may try to index from a pointer by adding a number of bytes. This is incorrect because C and C++ implicitly scale the operand by the size of the data type.
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, "Pointer Arithmetic", Page 277, Addison Wesley, 2006
Wpis z katalogu CWE 4.20.