p is not initialized, and copying anything to it will lead to Segmentation Fault and unpredictable results, because the memory location indicated by p is not indicated by the code.
Before you can copy a string to p, you must point to the memory pointed to by p.
you must use char [Buffersize];
for example char [12];
source share