Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: secret_size is an unsigned, hence it should refer to INT30-C.

...

The secret_size is tested to ensure that the integer multiplication (secret_size * 2) does not result in an integer overflow. (See INT32INT30-C. Ensure that unsigned integer operations on signed integers do not result in overflowwrap.)

Compliant Solution

A compliant program cannot rely on realloc() because it is not possible to clear the memory before the call. Instead, a custom function must be used that operates similarly to realloc() but sanitizes sensitive information as heap-based buffers are resized. Again, sanitization is done by overwriting the space to be deallocated with '\0' characters.

...