GCC's code isn't incorrect. As per the C standard, after you've dereferenced a NULL pointer then all behavior is undefined. If GCC emitted code that launched ICBMs after a NULL pointer dereference, that wouldn't violate the spec either.
The real WTF here is that people are still building "secure" software in a language where programmer mistakes cause undefined behavior...
The real WTF here is that people are still building "secure" software in a language where programmer mistakes cause undefined behavior...