So I was told if you use
you could prevent buffer overflow. However on compiling a test program, it returned BUFSIZE to be have 513 bytes max. Doesn't that mean if you go over 514 then you can have a buffer overflow.
char whatever[BUFSIZE +1]
Or does it make a difference if you use or to get the user inputs.
Here is my code to determine BUFSIZ
/* scanfTEST.c */
#define PRAISE "My that is a nice name"
int main (void)
int size, nameLEN;
printf("What is your name?\n");
scanf(" %s", name); /* ignores leading whitespace but not the following whitespace */
size = sizeof (name);
nameLEN = strlen(name);
printf("Hello, %s. %s\n", name, PRAISE);
printf("Your name can hold max %d bytes. But its is now of %d charaters\n", size, nameLEN);