I have little doubt about string reading in C.
string reading functions like gets, scanf, read, fscanf , fgets…
which C function can do a secure or safe string reading from any file?
Or
Which C function can be reliable to read a string in a file ?
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.
An input function will be secure/safe(not allow buffer overflow) if it takes the length of the buffer as an arguments so that the function does not read more char than the buffer can hold.
Of the function you’ve listed fgets() and read() take the buffer length as argument and can be considered safe.