char *host;
host = malloc(64 * sizeof(char)); /* spazio per 64 caratteri */
memset(host,0x00,host[63]);
I have a doubt: pointer can be seen as an “array”??
With the above code am i putting NULL into the 64 byte? (to prevent buffer overflow)
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.
Even if your code was correct (see @Dietrich’s answer), it doesn’t prevent buffer overflow. I can do this: