CWE-587ΒΆ

Assignment of a Fixed Address to a Pointer. [Pointer-Issues, Improper-Adherence-To-Coding-Standards]

Required inputs: IR

The product sets a pointer to a specific address other than NULL or 0. Using a fixed address is not portable, because that address will probably not be valid in all environments or platforms.
Demonstrative Examples
Example 1

This code assumes a particular function will always be found at a particular address. It assigns a pointer to that address and calls the function.

Example Language:C
    int (*pt2Function) (float, char, char)=0x08040000;
    int result2 = (*pt2Function) (12, 'a', 'b');
    // Here we can inject code to execute.

The same function may not always be found at the same memory address. This could lead to a crash, or an attacker may alter the memory at the expected address, leading to arbitrary code execution.

Excerpts from CWE [https://cwe.mitre.org], Copyright (C) 2006-2026, the MITRE Corporation. See section 9.4. "3rd-Party Licenses" in the documentation for full details.

Possible Messages

Key

Text

Severity

Disabled

conversion

Conversion of non-zero integer to pointer.

None

False

Options