Replaced strcpy to memset for cleaning buf