I have no idea why it's working for you, trying to assign to a string literal is well defined as being wrong and causing a run-time error. Here's the difference:
char *buffer = "anything goes here";
char buffer[] = "anything goes here";
The first a is a string literal, the pointer points to an address in memory that contains the characters 'anything goes here\0'. You cannot modify this string literal, doing so will result in an error. The second is an array of characters containing 'anything goes here\0'. An array can be modified, so assigning a new string to the array is perfectly legal.
When I run your program with a string literal, I get a run-time error and when I run it with an array it works fine.
-Prelude