...
Use the fill algorithm to assign the value '\0'
to evey element in the specified range.:
Code Block |
---|
const size_t max_fill = 100; std::string bs("01234567"); fill(bs.begin(), bs.begin()+std::min(max_fill, bs.length()), '\0' ); |
The range is specified as starting from the beginning of the string and ending at the minimum of the string length or the max_fill
constant value of 100.
Priority: P9 Level: L2
Unchecked element access can lead to out-of-bounds reads and writes and write-anywhere exploits. These exploits can in turn lead to the execution of arbitrary code with the permissions of the vulnerable process.
...