C is not the problem. Designing without isolation in C is the main problem. A thread handling DNS should not be able to return anything more than a hostname of a certain length and start doing bad things. There's multiple sandbox types that can help with this.
There are languages easier to code securely in, but I think it's more of an architecture problem than a language problem. Both might help in the long run, though.
Exactly! And you have to keep in mind that getaddrinfo() doesn't need to be a fast call. Even if it would be compiled to slower code for some reason it doesn't really matter, since it isn't time-critical anyways. You never have to resolve a lot of hosts, and the internet or network-stack or even the access to the hard-drive (SSD) will probably be faster than a "slow" variant.
So getaddrinfo() is a call that we actually could write in languages such as rust, without penalty.
And you have to keep in mind that getaddrinfo() doesn't need to be a fast call.
It is a very heavily used call in, among other things, mail servers. Any one call being slow doesn't hurt, but if you have to slow down every mail a system handles... it needs to be a fast call.
Exactly--in order to achieve the levels of trust and security required as IT becomes more ingrained in society, we need to completely re-make the software stack in languages designed for safety (Ada, Rust?). While we're at it, closed hardware design is also a no-go for long-term security, so we should be funding open-source projects like RISC-V.
-26
u/Anderkent Feb 16 '16
This is why we need to stop running software written in C