What’s wrong with gets anyhow?

gets is unsafe because it does not take into account the length of the buffer stdin is copied into. This means that the buffer can overflow when the string read from stdin is larger than expected, leading to security issues and general software instability.

Instead, use fgets with stdin as the third parameter.

Leave a Reply

Your email address will not be published.