#include #include void foo (char *str) { char buffer[12]; strcpy(buffer,str); printf("buffer is: %s\n",buffer); } int main() { char *str = "A string"; //works as expected //char *str = "A string that is definitely longer than 12"; //stack smashing detected! foo(str); printf("str is: %s\n",str); }