3 ms·
C++ is vastly different animal than C in this case. Most of the problems with C you are implying here are non issues in modern C++.
by Scea91 10y ago
C++ is vastly different animal than C in this case. Most of the problems with C you are implying here are non issues in modern C++.
- Someone1234 10y agoThe key being modern C++. A lot of C++ projects aren't written in modern C++ and out of the few that are, even then, programmers will mix in older less secure C++ because they lack experience with modern C++. So habits can actually hurt security. Ultimately when you have a language which mixes secure and insecure practises and lets the programmer decide, as an outside observer you have to assume the worst unless shown otherwise. C++ can be written very well, but C++ can also be written no better than C, it is project by project for which is which. Other languages don't have this issue. If you see a Rust, Go, Java, C#, etc block of code you can make certain assumptions about what classes of security issues it won't have.
- oconnore 10y agoYou're saying exactly the same thing. "This environment can shoot me in the foot, but not if I do it right." MISRA C with copious static analysis and a talented QA team is safe, too!
- steveklabnik 10y agoWeb browsers use modern C++ and still have security issues. It's a step forward, but not a panacea.
- abiox 10y agoto what extent? i imagine the codebases are quite...mature. and gigantic.
- pcwalton 10y agoEverywhere. We have been using smart pointers for a long time. Modern C++ doesn't add any memory safety protection beyond that which was already available with custom smart pointers in earlier versions of C++. In fact, I think modern C++ is less safe than earlier versions, due to new classes of potential bugs like use-after-move and the ease with which closed-over variable references in lambdas can become dangling.
- pcwalton 10y ago> Most of the problems with C you are implying here are non issues in modern C++. No, they aren't. Use after free is just as exploitable and is a severe concern in C++. In fact, it's worse in C++ than in C, due to the ubiquity of vtables.