anv: ensure device name contains terminating character
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 16 Jul 2017 14:28:09 +0000 (15:28 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Mon, 17 Jul 2017 13:36:38 +0000 (14:36 +0100)
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>
src/intel/vulkan/anv_device.c

index 34d4a67548184aded723e60cfe4009a71f300131..7e3eae43081735a4370cb22916938387b9dfaa6b 100644 (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);
 }