Versions Compared

Key

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

...

Wiki Markup
The {{calloc()}} function ensures that the newly allocated memory has also been cleared. Because {{sizeof(char)}} is guaranteed to be 1, this solution does not need to check for a numeric overflow as a result of using {{calloc()}} \[[MEM07-A. Ensure that size arguments to calloc() do not result in an integer overflow]\].

Wiki Markup
NOTE: It is possible that the call to {{memset()}} in this example will be optimized out \[[MSC06-A. Be aware of insecure compiler optimization when dealing with sensitive data]\].  Be very careful to ensure that any sensitive data is actually cleared from memory. 

Non-Compliant Code Example: realloc()

...