Versions Compared

Key

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

...

STL containers can be subject to the same vulnerabilities as array data types. The std::copy algorithm () algorithm provides no inherent bounds checking and can lead to a buffer overflow. In this noncompliant code example, a vector of integers is copied from src to dest using std::copy(). Because std::copy() does nothing to expand the dest vector, the program will overflow the buffer on copying the first element.

...