C doesn't prevent you from writing secure code, but it sure as hell makes it hard.
I believe it was Bryan Cantrill who made the problematic observation that the main issue is that C code doesn't compose.
I can write a perfectly correct library. You can write a perfectly correct library. When somebody else brings those two correct libraries together, though, the result can be terribly broken.
This is where the GC languages and Ada and Rust kick C and C++ asses.