new implementation of buffer initialization from char *