Fixed: insufficient memory allocated before strcpy