From: Pallantla Poornima Date: Thu, 14 Feb 2019 09:45:49 +0000 (+0000) Subject: test/distributor: replace sprintf with strlcpy X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7ab0770233ed5bb89845abf6b978ef15b2520bd8;p=dpdk.git test/distributor: replace sprintf with strlcpy sprintf function is not secure as it doesn't check the length of string. replaced sprintf with strlcpy. Fixes: f74df2c57e ("test/distributor: test single and burst API") Cc: stable@dpdk.org Signed-off-by: Pallantla Poornima Acked-by: David Hunt --- diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 98919ec0cc..da3348fd1f 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -11,6 +11,7 @@ #include #include #include +#include #define ITER_POWER 20 /* log 2 of how many iterations we do when timing. */ #define BURST 32 @@ -642,9 +643,11 @@ test_distributor(void) worker_params.dist = dist[i]; if (i) - sprintf(worker_params.name, "burst"); + strlcpy(worker_params.name, "burst", + sizeof(worker_params.name)); else - sprintf(worker_params.name, "single"); + strlcpy(worker_params.name, "single", + sizeof(worker_params.name)); rte_eal_mp_remote_launch(handle_work, &worker_params, SKIP_MASTER);