Use asprintf() instead of strcpy() and strcat()