Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Wiki MarkupMany functions accept pointers as arguments. If the function dereferences an invalid pointer (as in rule [EXP34-C. Do not dereference null pointers]) or reads or writes to a pointer that does not refer to an object, the results are [undefined|BB. Definitions#undefined]. Typically, the program will terminate abnormally when an invalid pointer is dereferenced, but it is possible for an invalid pointer to be dereferenced, and its memory changed, without abnormal termination \ [[Jack 2007|AA. Bibliography#Jack 07]\]. Such programs can be difficult to debug because of the difficulty in determining if a pointer is valid.

One way to eliminate invalid pointers is to define a function that accepts a pointer argument and indicates whether the pointer is valid or not, for some definition of valid. For example, the following function declares any pointer to be valid except NULL.

...

MITRE CWE: CWE-20, "Insufficient Input Validation"

Bibliography

...

\[[Jack 2007|AA. Bibliography#Jack 07]\] \[[van Sprundel 2006|AA. Bibliography#van Sprundel 06]\]
[van Sprundel 2006]

...

MEM09-C. Do not assume memory allocation functions initialize memory      08. Memory Management (MEM)