Walter Bright schrieb:
bearophile wrote:
Walter Bright:
The $10 billion mistake was C's conversion of arrays to pointers when
passing to a function.
http://www.drdobbs.com/blog/archives/2009/12/cs_biggest_mist.html
Sadly, there's an ongoing failure to recognize this, as it is never
addressed in any of the revisions to the C or C++ standards,
I agree, that's a very bad problem, probably worse than null-related
bugs.
It's infinitely worse. Null pointers do not result in memory corruption,
buffer overflows, and security breaches.
Not entirely true: Null Pointer dereferences *have* been used for security breaches, see for
example: http://lwn.net/Articles/342330/
The problem is that one can mmap() to 0/NULL so it can be dereferenced without
causing a crash.
Of course this is also a problem of the OS, it shouldn't allow mmap()ing to NULL in the first place
(it's now forbidden by default on Linux and FreeBSD afaik) - but some software (dosemu, wine)
doesn't work without it.
Cheers,
- Daniel