I am trying to make a short program just to learn about


I am trying to make a short program just to learn about buffer over flow and it's mitigation. It's prety easy but my mind is gone. Could someone please tell me if this is correct?

This just asks to enter your name, but I only allowed it to allocate enough buffer memory for 20 characters. If I want to mitigate it correctly I believe all I do is add more numbers. How could I actually limit the input?

Original: Increased to allow more buffer space w/o overflow: How to limitjQuery200048952666266959843_1517471435200

#include #include

using namespace std; using namespace std;

int main() { int main() {

char last_name[20]; char last_name[50];

printf ("Enter your last name: "); printf ("Enter your last name: ");

scanf ("%s", last_name); scanf ("%s", last_name);

return 0; return 0;

} }

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: I am trying to make a short program just to learn about
Reference No:- TGS02644088

Now Priced at $10 (50% Discount)

Recommended (96%)

Rated (4.8/5)