Why do i get segfault at the end of the application after everything's beed done properly ?
- by VaioIsBorn
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
unsigned char *stole;
unsigned char pass[] = "m4ak47";
printf("Vnesi password: \t");
scanf("%s", stole);
if(strncmp(stole, pass, sizeof(pass)) != 0)
{
printf("wrong password!\n");
exit(0);
}
else
printf("Password correct\n");
printf("some stuf here...\n\n");
return 0;
}
This program is working nice, but with one problem - if the password is correct then it DOES do the printing of 'some stuf here...' but it also shows me segmentation fault error at the end. Why ?