luca.rinaldi70 wrote: > Hello, > how can I find a buffer overflow in C/C++? > > For example: > > int x[10]; > int y[5][5]; > int z[5][5][2]; > > x[12] = 0; > y[3][7] = 8; > z[2][6][1] = 8; > > Is there a way or a tool/compiler to solve this problem? > > Thanks
For static structures like the above, the compiler can potentially figure out out-of-bounds scenarios. Try turning up the warning level. There are tools out there for detecting run-time out-of-bounds access attempts. BoundsChecker and GlowCode come to mind as examples of run-time tools. Lint is a static code checker. But expect to pay through the nose for those tools. VC++ will detect buffer overflows in debug builds but usually only runs the check code every so often (making it more difficult to determine where the overflow occurred). -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
