From 90f5eede124c6ffbe53095d573140ff0c5921213 Mon Sep 17 00:00:00 2001 From: Fiona Trahe Date: Mon, 2 Jul 2018 18:25:34 +0100 Subject: [PATCH] common/qat: replace snprintf Replaced snprintf with strlcpy for safer string copy Signed-off-by: Fiona Trahe Signed-off-by: Tomasz Jozwiak --- drivers/common/qat/qat_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c index 64f236e1c8..f32d723588 100644 --- a/drivers/common/qat/qat_device.c +++ b/drivers/common/qat/qat_device.c @@ -2,6 +2,8 @@ * Copyright(c) 2018 Intel Corporation */ +#include + #include "qat_device.h" #include "adf_transport_access_macros.h" #include "qat_sym_pmd.h" @@ -116,7 +118,7 @@ qat_pci_device_allocate(struct rte_pci_device *pci_dev) qat_dev = qat_pci_get_dev(qat_dev_id); memset(qat_dev, 0, sizeof(*qat_dev)); - snprintf(qat_dev->name, QAT_DEV_NAME_MAX_LEN, "%s", name); + strlcpy(qat_dev->name, name, QAT_DEV_NAME_MAX_LEN); qat_dev->qat_dev_id = qat_dev_id; qat_dev->pci_dev = pci_dev; switch (qat_dev->pci_dev->id.device_id) { -- 2.20.1