...
The function walk
should use a vector and an iterator. (This is left as an exercise for the reader.)
Consequences
Using arrays polymorphically can result in memory corruption which could lead to an attacker being able to execute arbitrary code.
References
- Meyers 06 Item 3: Never treat arrays polymorphically.
...