C/C++ overwriting array bounds -


what way detect bugs overwrite array bound?

int a[100]; (int = 0; i<1000; i++) a[i] = i; 

it helpful collect list of different strategies people have used in experience uncover bugs of type. example, doing backtrace on point of memory fault (for me doesn't work because stack has been corrupted).

  • static code analysis (e.g. lint)
  • runtime memory analysis (e.g. valgrind)
  • avoid fixed-size buffers, prefer dynamically sized containers
  • use sizeof() instead of magic numbers whenever can

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -