From 79a158130f53e9dada32f66de3f18b1e87ba7995 Mon Sep 17 00:00:00 2001 From: John Miller Date: Tue, 16 May 2017 12:14:15 -0400 Subject: [PATCH] net/ark: fix buffer not null terminated Coverity issue: 144512 Coverity issue: 144513 Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and pktgen") Cc: stable@dpdk.org Signed-off-by: John Miller --- drivers/net/ark/ark_pktchkr.c | 2 +- drivers/net/ark/ark_pktgen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c index 62b3673b87..c3040af3c7 100644 --- a/drivers/net/ark/ark_pktchkr.c +++ b/drivers/net/ark/ark_pktchkr.c @@ -372,7 +372,7 @@ set_arg(char *arg, char *val) o->v.INT = atoll(val); break; case OTSTRING: - strncpy(o->v.STR, val, ARK_MAX_STR_LEN); + snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val); break; } return 1; diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c index bdac054e0e..8c7a8a2d74 100644 --- a/drivers/net/ark/ark_pktgen.c +++ b/drivers/net/ark/ark_pktgen.c @@ -354,7 +354,7 @@ pmd_set_arg(char *arg, char *val) o->v.INT = atoll(val); break; case OTSTRING: - strncpy(o->v.STR, val, ARK_MAX_STR_LEN); + snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val); break; } return 1; -- 2.20.1