Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

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

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 <iostream> #include <iostream>
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;
} }

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"