Interesting, you all mighty wiki says its in the last sentence:
this is known as a buffer overflow attack.
The posted code is in no case a buffer overflow and also not a stack overflow.
I told you that you can inject new code when you let the user write into the memory by eg. don't check your strings but just use strcpy. That is _NOT_ the case in the sample code.
Segfaults should also not occur when you try to execute something from the heap but only when you try to access unmapped memory.