Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why is it usually a bad idea to use gets()? Suggest a workaround.

Answer Posted / hrpynux@gmail.com

The function gets() reads characters from the stdin and stores them at the provided input buffer. However, gets() will keep reading until it encounters a newline character. Unless the buffer is large enough, or the length of the line being read is known ahead of time, gets() can potentially overflow the input buffer and start overwriting memory it is not supposed to, wreaking havoc or opening security vulnerabilities.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is extern storage class in c?

947


What is a constant?

997


Write a program to swap two numbers without using third variable?

1251


Define recursion in c.

1202


What are the different types of C instructions?

1246


What is typedf?

1069


How will you write a code for accessing the length of an array without assigning it to another variable?

1004


Explain how are portions of a program disabled in demo versions?

1075


How can I get back to the interactive keyboard if stdin is redirected?

1137


What are terms in math?

979


What is c++ used for today?

1063


Who is the founder of c language?

1111


What is adt in c programming?

1106


How are Structure passing and returning implemented by the complier?

1109


Explain how do you print only part of a string?

1163