anv: use safer snprintf() to ensure NULL string-terminator
authorEric Engestrom <eric.engestrom@intel.com>
Thu, 16 Aug 2018 14:46:31 +0000 (15:46 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 16 Aug 2018 16:38:31 +0000 (17:38 +0100)
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_device.c

index c40b94d69f349828b96407727ea9ce8e730b00e6..897249baa6aea4958c231ac848e4b38d379c9e19 100644 (file)
@@ -325,7 +325,7 @@ anv_physical_device_init(struct anv_physical_device *device,
    device->instance = instance;
 
    assert(strlen(path) < ARRAY_SIZE(device->path));
-   strncpy(device->path, path, ARRAY_SIZE(device->path));
+   snprintf(device->path, ARRAY_SIZE(device->path), "%s", path);
 
    device->no_hw = getenv("INTEL_NO_HW") != NULL;