If I use std::cin, std::cout and std::string, is there any possibility that someone will exploit the buffer overflow?
I ask this because I still see a lot of people that still use null-terminated strings instead of standard containers in C++.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends. Of course, when you use C-style code/API’s, there is no difference.
But using STL or C++ idioms doesn’t guarantee that you’re safe.
C++ gives you the choice, always. Contrast these two near-identical twins:
safe variant: