The function `strlen` returns the size of the string without a terminating
null-character, therefore a request to allocate memory space for a parsed
argument is too small by 1.

Fixes: 99ab2806687b ("common/qat: isolate parser arguments configuration")
Cc: sta...@dpdk.org

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusz...@intel.com>
---
v2:
- changed the placement of `len` incrementation

 drivers/common/qat/qat_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/common/qat/qat_device.c b/drivers/common/qat/qat_device.c
index bca88fd9bd..b582e3bf8b 100644
--- a/drivers/common/qat/qat_device.c
+++ b/drivers/common/qat/qat_device.c
@@ -229,6 +229,7 @@ qat_dev_parse_command_line(struct qat_pci_device *qat_dev,
        len = strlen(devargs->drv_str);
        if (len == 0)
                return 0;
+       ++len;
        /* Allocate per-device command line */
        qat_dev->command_line = rte_malloc(NULL, len, 0);
        if (qat_dev->command_line == NULL) {
-- 
2.43.0

Reply via email to