8 ms·
C++ is not C. They are two totally different languages. Boundaries and overflows are not an issue in C++ like they are in C. I have no idea why people can't und
by anon-123 9y ago
C++ is not C. They are two totally different languages. Boundaries and overflows are not an issue in C++ like they are in C. I have no idea why people can't understand this.
- sanxiyn 9y agoBecause it is not true. C++ is not memory safe. Especially, C++ is not very good at handling use-after-free.
- blub 9y agoIt's not memory safe, but with some good practices and library support it's in a different league of safety compared to C. Just the availability of smart pointers, vector array and string puts it waaay ahead of plain C. The bugs in dnsmasq were buffer overflows. In this case, the good practices would be always use std::array and std::vector and index with "at". Tackling UAF is more complex. It involves using smart pointers exclusively with a runtime-check on dereferencing. This will result in some performance loss. P.S: I'm not saying it trivial to secure C++ code, nor that every project out there is using these techniques. It's a worthwile task to try to make existing C++ projects as safe as possible, and that's an effort parallel to Rust which should have very beneficial results.