anv: ensure device name contains terminating character

v2: Use sizeof() (Chris)

CID: 1415113
Reported-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
Lionel Landwerlin 2017-07-16 15:28:09 +01:00
parent f03f893cb8
commit 59adde0eab

View file

@ -891,8 +891,8 @@ void anv_GetPhysicalDeviceProperties(
.sparseProperties = {0}, /* Broadwell doesn't do sparse. */
};
strncpy(pProperties->deviceName, pdevice->name,
VK_MAX_PHYSICAL_DEVICE_NAME_SIZE);
snprintf(pProperties->deviceName, sizeof(pProperties->deviceName),
"%s", pdevice->name);
memcpy(pProperties->pipelineCacheUUID,
pdevice->pipeline_cache_uuid, VK_UUID_SIZE);
}