You can write this in any language. None of them will stop you. I'm on the cutting edge of "stop using C", but this isn't C's fault.
This vulnerability is the fault of the C ecosystem where there is no reasonable project level package manager so everyone writes everything from scratch. It's exacerbated by the combination of a lack of generics (rust/java's solution), introspection (java/python's solution), and poor preprocessor in C (go's solution) so it wouldn't even be easy to make a ergonomic general purpose parser.
This file was written like 20 years ago.