Travis
2010-11-26 20:49:27 UTC
user_name_ptr = (char*)malloc(sizeof(char)*100);
user_name = user_name_ptr;
c = getchar();
while(c != '\n')
{
*user_name_ptr = c;
user_name_ptr++;
c = getchar();
}
*user_name_ptr = "\0";
printf("User_Name is: %s\n", user_name);
Other than the obvious security issues and bad code, what is wrong with this??
It Seg Faults... gdb backtrace shows that its segfualting when trying to printf()