summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-14 13:01:07 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-14 23:32:23 +0200
commitf2790f9cf8486b01576c6ddfd60d2ce434a2b3e4 (patch)
treeb24bcc4c1ab2700e330d18f894880ac9857bc4f3
parent3cef37eb98769935fbc12e01f06d9ac36d430071 (diff)
downloaddpdk-f2790f9cf8486b01576c6ddfd60d2ce434a2b3e4.zip
dpdk-f2790f9cf8486b01576c6ddfd60d2ce434a2b3e4.tar.gz
dpdk-f2790f9cf8486b01576c6ddfd60d2ce434a2b3e4.tar.xz
app/bbdev: use strcpy for allocated string
app/test-bbdev/test_bbdev_vector.c:895:3: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy(entry, line, strlen(line)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ app/test-bbdev/test_bbdev_vector.c:917:5: error: ‘strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncat(entry, line, strlen(line)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
-rw-r--r--app/test-bbdev/test_bbdev_vector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index a37e35f..81b8ee7 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -891,8 +891,7 @@ test_bbdev_vector_read(const char *filename,
goto exit;
}
- memset(entry, 0, strlen(line) + 1);
- strncpy(entry, line, strlen(line));
+ strcpy(entry, line);
/* check if entry ends with , or = */
if (entry[strlen(entry) - 1] == ','
@@ -914,7 +913,8 @@ test_bbdev_vector_read(const char *filename,
}
entry = entry_extended;
- strncat(entry, line, strlen(line));
+ /* entry has been allocated accordingly */
+ strcpy(&entry[strlen(entry)], line);
if (entry[strlen(entry) - 1] != ',')
break;