summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-04-04 10:05:48 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-13 17:20:36 +0000
commitd13034a6d1a239af07948ebe6a399c6aec5ddbbc (patch)
tree51534d97091bf18d77f07756c1bd35d893d56aa9 /src/plugins
parent11903b8db67d9de4d86cca856a8a32aa43f838f5 (diff)
misc: sprintf be gone
Along with related static analysis warnings... Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2c6949c7a2250b8f76a63508c7c210daecfe0f91 (cherry picked from commit 3e07a4a1e843267892dc291a833d93bd70597011)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_client.c4
-rw-r--r--src/plugins/hs_apps/vcl/sock_test_server.c3
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_client.c8
-rw-r--r--src/plugins/hs_apps/vcl/vcl_test_server.c2
4 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/vcl/sock_test_client.c b/src/plugins/hs_apps/vcl/sock_test_client.c
index ed43e7faaf1..6f5fb074503 100644
--- a/src/plugins/hs_apps/vcl/sock_test_client.c
+++ b/src/plugins/hs_apps/vcl/sock_test_client.c
@@ -327,7 +327,7 @@ echo_test_client ()
{
static char buf[64];
- sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", tsock->fd);
vcl_test_stats_dump (buf, &tsock->stats,
1 /* show_rx */ , 1 /* show tx */ ,
ctrl->cfg.verbose);
@@ -498,7 +498,7 @@ stream_test_client (vcl_test_t test)
{
static char buf[64];
- sprintf (buf, "CLIENT (fd %d) RESULTS", tsock->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", tsock->fd);
vcl_test_stats_dump (buf, &tsock->stats,
test == VCL_TEST_TYPE_BI /* show_rx */ ,
1 /* show tx */ , ctrl->cfg.verbose);
diff --git a/src/plugins/hs_apps/vcl/sock_test_server.c b/src/plugins/hs_apps/vcl/sock_test_server.c
index 110ff3e183b..bd777ccb917 100644
--- a/src/plugins/hs_apps/vcl/sock_test_server.c
+++ b/src/plugins/hs_apps/vcl/sock_test_server.c
@@ -238,7 +238,8 @@ stream_test_server_start_stop (sock_server_conn_t * conn,
{
static char buf[64];
- sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
+ snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS",
+ tc->fd);
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
test == VCL_TEST_TYPE_BI
/* show tx */ ,
diff --git a/src/plugins/hs_apps/vcl/vcl_test_client.c b/src/plugins/hs_apps/vcl/vcl_test_client.c
index 55bc7889098..30b48d8d145 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_client.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_client.c
@@ -394,7 +394,7 @@ vtc_accumulate_stats (vcl_test_client_worker_t * wrk,
if (ctrl->cfg.verbose > 1)
{
- sprintf (buf, "CLIENT (fd %d) RESULTS", ts->fd);
+ snprintf (buf, sizeof (buf), "CLIENT (fd %d) RESULTS", ts->fd);
vcl_test_stats_dump (buf, &ts->stats, show_rx, 1 /* show tx */ ,
ctrl->cfg.verbose);
}
@@ -553,10 +553,10 @@ vtc_print_stats (vcl_test_session_t * ctrl)
}
if (is_echo)
- sprintf (buf, "Echo");
+ snprintf (buf, sizeof (buf), "Echo");
else
- sprintf (buf, "%s-directional Stream",
- ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
+ snprintf (buf, sizeof (buf), "%s-directional Stream",
+ ctrl->cfg.test == VCL_TEST_TYPE_BI ? "Bi" : "Uni");
}
static void
diff --git a/src/plugins/hs_apps/vcl/vcl_test_server.c b/src/plugins/hs_apps/vcl/vcl_test_server.c
index be225fa8c9e..364c32fc9f8 100644
--- a/src/plugins/hs_apps/vcl/vcl_test_server.c
+++ b/src/plugins/hs_apps/vcl/vcl_test_server.c
@@ -180,7 +180,7 @@ vts_server_start_stop (vcl_test_server_worker_t * wrk,
conn->stats.stop.tv_sec -= VCL_TEST_DELAY_DISCONNECT;
if (conn->cfg.verbose)
{
- sprintf (buf, "SERVER (fd %d) RESULTS", tc->fd);
+ snprintf (buf, sizeof (buf), "SERVER (fd %d) RESULTS", tc->fd);
vcl_test_stats_dump (buf, &tc->stats, 1 /* show_rx */ ,
is_bi /* show tx */ , conn->cfg.verbose);
}