Does exists a tool that can monitor illegal writes to memory ?
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Only if the memory area after your allocated buffer is marked as invalid or readonly.
Usually small buffer overflows are not catched, because the remainder of the
memory page where your buffer is located is not marked invalid, and therefore
produces no error when written to.
@freak
thanx for the explanation.
how to declare such memory areas as invalid ?
and a tool ? a microsoft one perhaps...
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
A good way on Windows is to use HeapValidate() to help tracking down such bug. It's not easy if the overflow is only 1 byte for example, as Windows always reserve by block of 16 bytes. So writting after won't produce anything wrong.
I don't think it's a bug, it seems normal but surprising me first time.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer