anv: use safer snprintf() to ensure NULL string-terminator

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Eric Engestrom 2018-08-16 15:46:31 +01:00
parent d6aea40326
commit 6cf0d4f91f

View 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;