by Theriac25 · 12y ago · 0 comments
No you couldn't've. C is fundamentally unsafe language and people like you should stop pretending it isn't.
Discounting bad PHP, a huge majority of bugs are in C/C++ code. And "past popularity" isn't a good explanation, because a lot of the software is fairly recent.
So, the following isn't an opinion. It's simply a matter of observable fact. If you write in C/C++, you are far more likely to introduce security vulnerabilities than in other languages; therefore, unless there's a pressing reason to use these languages, don't.
That is, I don't think this exercise really shows what you think it does. Consider, if 90% of the software out there is in c/c++, and you had equal representation of language to vulnerability, then you would expect 90% of the vulnerabilities to be in c/c++. This would not mean that you are more likely to write bugs in those languages. In fact, unless I misunderstand, it would simply mean you are just as likely to have bugs there as otherwise.
Right?
1. A huge number of vulnerabilities affect C/C++ programs, almost all of which are memory based.
2. Memory-managed languages take care of this for you.
3. Therefore, C/C++ shouldn't be a default choice in domains where a managed language does just as well (a separate question).
Everything else is tangential.
But here are some reasons why your second paragraph is dangerously wrong (and why my claim was not as you characterize):
1. It only applies if we assume a uniform distribution of security effort across languages.
2. It only applies if we assume that c/c++ is being used for the same class of applications programs written in other languages, or that the applications have similar attack surfaces.
3. It only applies if we assume a uniform distribution of security effort over all code regardless of age.
and so on...
And also, 90% of code -- especially relatively recent code -- is not written in c/c++.
And in the case of crypto code, one could argue that there is a very good reason to use C/C++: to prevent timing attacks.