Versions Compared

Key

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

Dangling pointers can lead to exploitable double-free and access-freed-memory vulnerabilities. A simple yet effective way to eliminate dangling pointers and avoid many memory related vulnerabilities is to set pointers to NULL after they have been freed. Calling free() on a NULL null pointer results in no action being taken by free().

...

As stated above, calling free() on a NULL null pointer results in no action being taken by free(). By setting message equal to NULL after it has been freed, the double-free vulnerability has been eliminated.

...