Versions Compared

Key

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

...

Noncompliant Code Example (Windows)

This compliant solution noncompliant code example uses the ZeroMemory() function provided by many versions of the Microsoft Visual Studio compiler.

...

However, it should be noted that both calling functions and accessing volatile qualified objects can still be optimized out (while maintaining strict conformance to the standard), so the above this compliant solution may still not work in some cases.

Risk Assessment

If the compiler optimizes out memory-clearing code, an attacker can gain access to sensitive data.

...