String length is known, use memcpy instead of strcpy.

This commit is contained in:
Bartosz Taudul 2022-05-01 12:46:09 +02:00
parent 20cfdc3022
commit ce4c83d45b
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -4841,8 +4841,9 @@ phdr_callback_mock (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED,
auto ptr = s_phdrData.push_next();
if (info->dlpi_name)
{
ptr->dlpi_name = (char*)tracy_malloc (strlen (info->dlpi_name) + 1);
strcpy (ptr->dlpi_name, info->dlpi_name);
size_t sz = strlen (info->dlpi_name) + 1;
ptr->dlpi_name = (char*)tracy_malloc (sz);
memcpy (ptr->dlpi_name, info->dlpi_name, sz);
}
else ptr->dlpi_name = nullptr;
ptr->dlpi_addr = info->dlpi_addr;