Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
char *char_ptr = "example";
int *int_ptr;

int *voidPtr2intPtr(void *v_pointer){
  return v_pointer;
}
int_ptr= voidPtr2intPtr(char_ptr);

Pointer In this example the pointer might be aligned on even boundary, once a 1 byte boundary. Once it is cast to an int some architectures will require it to be on 4 byte boundaries. Pointers are often cast because a void* cannot be dereferenced. Careless coding can result in an arbitrary pointer type being used irregardless of its alignment.

...

Code Block
bgColor#ccccff
-makeMake specific functions (avoid use of void*)

-alwaysAlways use strictest alignment type for arbitrary pointers.

Risk Assessment

Accessing a pointer that is no longer on the correct access boundary can cause a program to crash, give wrong information or have slow pointer accesses (if the architecture does not care about alignment).

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DRAFT

1 (low)

2 (probable)

2 (medium)

P4

L3

...