I\'ve just compiled this C program using Cygwin\'s gcc:
#include
void main (){
char *str;
gets(str);
printf(\"%s\",str);
}
>
Access memory region pointed to by uninitialized pointer is undefined behavior, it could crash, it also could look like working normally. In a word, you cannot predict its behavior.
How come I'm not getting a segmentation fault?
Uninitialized pointer has an undetermined value, it could point to anywhere, if it points to some big enough writable region accidently, that program will "work" normally.