Skip to content
OpenAdvisories

Weakness (CWE)

CWE-467: Use of sizeof() on a Pointer Type

Variant Draft

The code calls sizeof() on a pointer type, when the programmer intended to determine the size of the data that is being pointed to.

How to prevent it (1 mitigation)
  1. Implementation

    Use expressions such as "sizeof(*pointer)" instead of "sizeof(pointer)", unless you intend to run sizeof() on a pointer type to gain some platform independence or if you are allocating a variable on the stack.

Source: MITRE CWE-467

0 results · Clear filters · Feed

Nothing found.