News for hackers. Stuff that matters.
Re:Memory Safe Languages in Android 13 by nneonneo on Friday December 02, 2022 @01:17AM (#33827431)
Oh my bad! That must be why C++, a definitely not super unsafe language that is basically totally different from C, lets you do this:

    char buf[10];
    std::cin >> buf;
    std::cout << buf << std::endl;
g++ -Wall -std=c++2a (sorry, I’ve only got GCC 9), no warnings or errors, happily overruns the stack when fed more than 10 characters. This code is essentially equivalent to the C gets(buf) (splitting on whitespace instead of newline), but gets is deprecated and generates big warnings on most modern C compilers. Yet, operator>>(char *) does not.

Sure, you can write secure code in C++. You can write secure code in C too, even if that language is “super unsafe”. But neither language will stop you from writing insecure code either.

There are no comments on this comment yet.