C can be written in a way to minimize vulnerabilities. You use things like critical thinking and sanitize/validate inputs to functions and before you call libraries.
The log4j vulnerabilities and others like it where input validation specific to what you expect would not happen in properly paranoid systems.