From: John Miller Date: Tue, 16 May 2017 16:14:15 +0000 (-0400) Subject: net/ark: fix buffer not null terminated X-Git-Tag: spdx-start~3165 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=79a158130f53e9dada32f66de3f18b1e87ba7995;p=dpdk.git 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 --- 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;