I'm looking at this code example for class and I am new with buffer overflows. How can this exmple be modified to avoid buffer overflow attacks? Also, If anyone knows of a good article on buffer overflows, please post it. Thanks!
void GetProfileFor( const char *name,
char *profile,
int profileLen );
int main() {
char *profile = malloc( 1024 );
char name[128];
printf( “Enter your name: ” );
gets( name );
GetProfileFor( name, profile, 1024 );
printf( “\nYour profile: %s\n”, profile );
return 0; }