Do a global replace of snprintf(..."%s",...) with strlcpy, adding in the
rte_string_fns.h header if needed.  The function changes in this patch were
auto-generated via command:

  spatch --sp-file devtools/cocci/strlcpy.cocci --dir . --in-place

and then the files edited using awk to add in the missing header:

  gawk -i inplace '/include <rte_/ && ! seen { \
        print "#include <rte_string_fns.h>"; seen=1} {print}'

Signed-off-by: Bruce Richardson <[email protected]>
---
 app/test-acl/main.c                           |  3 +-
 app/test-eventdev/evt_options.c               |  3 +-
 app/test-pmd/cmdline_flow.c                   | 13 +++----
 app/test/test_table_acl.c                     | 11 +++---
 drivers/bus/dpaa/base/fman/of.c               |  7 ++--
 drivers/bus/pci/linux/pci_uio.c               |  3 +-
 .../crypto/aesni_mb/rte_aesni_mb_pmd_ops.c    |  3 +-
 .../aesni_mb/rte_aesni_mb_pmd_ops_compat.c    |  3 +-
 drivers/crypto/ccp/rte_ccp_pmd.c              |  6 ++--
 .../scheduler/rte_cryptodev_scheduler.c       |  8 ++---
 drivers/event/opdl/opdl_ring.c                |  3 +-
 drivers/net/af_packet/rte_eth_af_packet.c     |  5 +--
 drivers/net/ark/ark_pktchkr.c                 |  3 +-
 drivers/net/ark/ark_pktgen.c                  |  3 +-
 drivers/net/atlantic/atl_ethdev.c             |  5 +--
 drivers/net/bnx2x/bnx2x_ethdev.c              |  8 ++---
 drivers/net/bnxt/bnxt_stats.c                 | 36 +++++++++----------
 drivers/net/dpaa/dpaa_ethdev.c                |  8 ++---
 drivers/net/e1000/igb_ethdev.c                | 17 ++++-----
 drivers/net/ena/ena_ethdev.c                  | 11 +++---
 drivers/net/failsafe/failsafe_eal.c           |  6 ++--
 drivers/net/i40e/rte_pmd_i40e.c               |  5 +--
 drivers/net/ice/ice_ethdev.c                  | 11 +++---
 drivers/net/ixgbe/ixgbe_ethdev.c              | 35 +++++++++---------
 drivers/net/kni/rte_eth_kni.c                 |  3 +-
 drivers/net/liquidio/lio_ethdev.c             |  5 +--
 drivers/net/mvneta/mvneta_ethdev.c            |  3 +-
 drivers/net/mvpp2/mrvl_ethdev.c               |  5 +--
 drivers/net/qede/qede_ethdev.c                | 22 ++++++------
 drivers/net/virtio/virtio_user/vhost_user.c   |  3 +-
 .../net/virtio/virtio_user/virtio_user_dev.c  |  3 +-
 examples/ethtool/lib/rte_ethtool.c            |  8 ++---
 examples/l2fwd-crypto/main.c                  |  4 +--
 examples/vm_power_manager/channel_manager.c   |  7 ++--
 examples/vm_power_manager/channel_monitor.c   | 14 ++++----
 lib/librte_acl/rte_acl.c                      |  3 +-
 lib/librte_bbdev/rte_bbdev.c                  |  3 +-
 lib/librte_cfgfile/rte_cfgfile.c              | 22 ++++++------
 lib/librte_compressdev/rte_compressdev.c      |  5 +--
 lib/librte_compressdev/rte_compressdev_pmd.c  |  3 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.c      |  3 +-
 lib/librte_eal/common/eal_common_options.c    |  3 +-
 lib/librte_efd/rte_efd.c                      |  3 +-
 lib/librte_eventdev/rte_eventdev.c            |  4 +--
 lib/librte_flow_classify/rte_flow_classify.c  |  4 +--
 lib/librte_jobstats/rte_jobstats.c            |  3 +-
 lib/librte_latencystats/rte_latencystats.c    |  5 +--
 lib/librte_member/rte_member.c                |  3 +-
 lib/librte_mempool/rte_mempool_ops.c          |  3 +-
 lib/librte_power/power_acpi_cpufreq.c         |  3 +-
 lib/librte_power/power_pstate_cpufreq.c       |  3 +-
 lib/librte_rawdev/rte_rawdev.c                |  3 +-
 lib/librte_reorder/rte_reorder.c              |  5 +--
 53 files changed, 201 insertions(+), 173 deletions(-)

diff --git a/app/test-acl/main.c b/app/test-acl/main.c
index 648525af5..b80179417 100644
--- a/app/test-acl/main.c
+++ b/app/test-acl/main.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_acl.h>
 #include <getopt.h>
 #include <string.h>
@@ -928,7 +929,7 @@ print_usage(const char *prgname)
                n += rc;
        }
 
-       snprintf(buf + n, sizeof(buf) - n, "%s", acl_alg[i].name);
+       strlcpy(buf + n, acl_alg[i].name, sizeof(buf) - n);
 
        fprintf(stdout,
                PRINT_USAGE_START
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index cfa43a165..cb95a32b8 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -7,6 +7,7 @@
 #include <inttypes.h>
 #include <getopt.h>
 
+#include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_eventdev.h>
 #include <rte_lcore.h>
@@ -110,7 +111,7 @@ evt_parse_timer_prod_type_burst(struct evt_options *opt,
 static int
 evt_parse_test_name(struct evt_options *opt, const char *arg)
 {
-       snprintf(opt->test_name, EVT_TEST_NAME_MAX_LEN, "%s", arg);
+       strlcpy(opt->test_name, arg, EVT_TEST_NAME_MAX_LEN);
        return 0;
 }
 
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 36659a64a..1c83bc9bc 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -13,6 +13,7 @@
 #include <arpa/inet.h>
 #include <sys/socket.h>
 
+#include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_eth_ctrl.h>
 #include <rte_ethdev.h>
@@ -4694,7 +4695,7 @@ comp_boolean(struct context *ctx, const struct token 
*token,
        (void)token;
        for (i = 0; boolean_name[i]; ++i)
                if (buf && i == ent)
-                       return snprintf(buf, size, "%s", boolean_name[i]);
+                       return strlcpy(buf, boolean_name[i], size);
        if (buf)
                return -1;
        return i;
@@ -4711,8 +4712,8 @@ comp_action(struct context *ctx, const struct token 
*token,
        (void)token;
        for (i = 0; next_action[i]; ++i)
                if (buf && i == ent)
-                       return snprintf(buf, size, "%s",
-                                       token_list[next_action[i]].name);
+                       return strlcpy(buf, token_list[next_action[i]].name,
+                                      size);
        if (buf)
                return -1;
        return i;
@@ -4776,7 +4777,7 @@ comp_vc_action_rss_type(struct context *ctx, const struct 
token *token,
        if (!buf)
                return i + 1;
        if (ent < i)
-               return snprintf(buf, size, "%s", rss_type_table[ent].str);
+               return strlcpy(buf, rss_type_table[ent].str, size);
        if (ent == i)
                return snprintf(buf, size, "end");
        return -1;
@@ -4961,7 +4962,7 @@ cmd_flow_complete_get_elt(cmdline_parse_token_hdr_t *hdr, 
int index,
        if (index >= i)
                return -1;
        token = &token_list[list[index]];
-       snprintf(dst, size, "%s", token->name);
+       strlcpy(dst, token->name, size);
        /* Save index for cmd_flow_get_help(). */
        ctx->prev = list[index];
        return 0;
@@ -4978,7 +4979,7 @@ cmd_flow_get_help(cmdline_parse_token_hdr_t *hdr, char 
*dst, unsigned int size)
        if (!size)
                return -1;
        /* Set token type and update global help with details. */
-       snprintf(dst, size, "%s", (token->type ? token->type : "TOKEN"));
+       strlcpy(dst, (token->type ? token->type : "TOKEN"), size);
        if (token->help)
                cmd_flow.help_str = token->help;
        else
diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c
index 33e2f6ee6..22136a396 100644
--- a/app/test/test_table_acl.c
+++ b/app/test/test_table_acl.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_hexdump.h>
 #include "test_table.h"
 #include "test_table_acl.h"
@@ -467,7 +468,7 @@ setup_acl_pipeline(void)
                        memset(&keys[n], 0, sizeof(struct 
rte_table_acl_rule_add_params));
                        key_array[n] = &keys[n];
 
-                       snprintf(line, sizeof(line), "%s", lines[n]);
+                       strlcpy(line, lines[n], sizeof(line));
                        printf("PARSING [%s]\n", line);
 
                        ret = parser(line, &keys[n]);
@@ -509,7 +510,7 @@ setup_acl_pipeline(void)
                        memset(&keys[n], 0, sizeof(struct 
rte_table_acl_rule_delete_params));
                        key_array[n] = &keys[n];
 
-                       snprintf(line, sizeof(line), "%s", lines[n]);
+                       strlcpy(line, lines[n], sizeof(line));
                        printf("PARSING [%s]\n", line);
 
                        ret = parse_cb_ipv4_rule_del(line, &keys[n]);
@@ -545,7 +546,7 @@ setup_acl_pipeline(void)
                parser = parse_cb_ipv4_rule;
 
                for (n = 1; n <= 5; n++) {
-                       snprintf(line, sizeof(line), "%s", lines[n-1]);
+                       strlcpy(line, lines[n - 1], sizeof(line));
                        printf("PARSING [%s]\n", line);
 
                        ret = parser(line, &rule_params);
@@ -571,7 +572,7 @@ setup_acl_pipeline(void)
 
                /* delete a few rules */
                for (n = 2; n <= 3; n++) {
-                       snprintf(line, sizeof(line), "%s", lines[n-1]);
+                       strlcpy(line, lines[n - 1], sizeof(line));
                        printf("PARSING [%s]\n", line);
 
                        ret = parser(line, &rule_params);
@@ -598,7 +599,7 @@ setup_acl_pipeline(void)
 
                /* Try to add duplicates */
                for (n = 1; n <= 5; n++) {
-                       snprintf(line, sizeof(line), "%s", lines[n-1]);
+                       strlcpy(line, lines[n - 1], sizeof(line));
                        printf("PARSING [%s]\n", line);
 
                        ret = parser(line, &rule_params);
diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c
index a7f3174e4..1e97be54e 100644
--- a/drivers/bus/dpaa/base/fman/of.c
+++ b/drivers/bus/dpaa/base/fman/of.c
@@ -6,6 +6,7 @@
  */
 
 #include <of.h>
+#include <rte_string_fns.h>
 #include <rte_dpaa_logs.h>
 
 static int alive;
@@ -60,7 +61,7 @@ process_file(struct dirent *dent, struct dt_dir *parent)
                return;
        }
        f->node.is_file = 1;
-       snprintf(f->node.node.name, NAME_MAX, "%s", dent->d_name);
+       strlcpy(f->node.node.name, dent->d_name, NAME_MAX);
        snprintf(f->node.node.full_name, PATH_MAX, "%s/%s",
                 parent->node.node.full_name, dent->d_name);
        f->parent = parent;
@@ -117,8 +118,8 @@ iterate_dir(struct dirent **d, int num, struct dt_dir *dt)
                                perror("malloc");
                                return -ENOMEM;
                        }
-                       snprintf(subdir->node.node.name, NAME_MAX, "%s",
-                                d[loop]->d_name);
+                       strlcpy(subdir->node.node.name, d[loop]->d_name,
+                               NAME_MAX);
                        snprintf(subdir->node.node.full_name, PATH_MAX,
                                 "%s/%s", dt->node.node.full_name,
                                 d[loop]->d_name);
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 09ecbb7aa..65f4896b9 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -16,6 +16,7 @@
 #include <sys/io.h>
 #endif
 
+#include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
@@ -268,7 +269,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
                goto error;
        }
 
-       snprintf((*uio_res)->path, sizeof((*uio_res)->path), "%s", devname);
+       strlcpy((*uio_res)->path, devname, sizeof((*uio_res)->path));
        memcpy(&(*uio_res)->pci_addr, &dev->addr, sizeof((*uio_res)->pci_addr));
 
        return 0;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
index 3a8374ef3..8d15b99d4 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_cryptodev_pmd.h>
@@ -614,7 +615,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct 
aesni_mb_qp *qp,
        struct rte_ring *r;
        char ring_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 
-       unsigned int n = snprintf(ring_name, sizeof(ring_name), "%s", qp->name);
+       unsigned int n = strlcpy(ring_name, qp->name, sizeof(ring_name));
 
        if (n >= sizeof(ring_name))
                return NULL;
diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c 
b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
index 79a38b25e..379a0c003 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops_compat.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_cryptodev_pmd.h>
@@ -565,7 +566,7 @@ aesni_mb_pmd_qp_create_processed_ops_ring(struct 
aesni_mb_qp *qp,
        struct rte_ring *r;
        char ring_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 
-       unsigned int n = snprintf(ring_name, sizeof(ring_name), "%s", qp->name);
+       unsigned int n = strlcpy(ring_name, qp->name, sizeof(ring_name));
 
        if (n >= sizeof(ring_name))
                return NULL;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index b4bb5528f..4810d799c 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -2,6 +2,7 @@
  *   Copyright(c) 2018 Advanced Micro Devices, Inc. All rights reserved.
  */
 
+#include <rte_string_fns.h>
 #include <rte_bus_pci.h>
 #include <rte_bus_vdev.h>
 #include <rte_common.h>
@@ -298,9 +299,8 @@ cryptodev_ccp_create(const char *name,
        uint8_t cryptodev_cnt = 0;
 
        if (init_params->def_p.name[0] == '\0')
-               snprintf(init_params->def_p.name,
-                        sizeof(init_params->def_p.name),
-                        "%s", name);
+               strlcpy(init_params->def_p.name, name,
+                       sizeof(init_params->def_p.name));
 
        dev = rte_cryptodev_pmd_create(init_params->def_p.name,
                                       &vdev->device,
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c 
b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index a21428606..1fef88f11 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright(c) 2017 Intel Corporation
  */
+#include <rte_string_fns.h>
 #include <rte_reorder.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
@@ -443,8 +444,7 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t 
scheduler_id,
                                RTE_CRYPTODEV_NAME_MAX_LEN);
                return -EINVAL;
        }
-       snprintf(sched_ctx->name, sizeof(sched_ctx->name), "%s",
-                       scheduler->name);
+       strlcpy(sched_ctx->name, scheduler->name, sizeof(sched_ctx->name));
 
        if (strlen(scheduler->description) >
                        RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1) {
@@ -453,8 +453,8 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t 
scheduler_id,
                                RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN - 1);
                return -EINVAL;
        }
-       snprintf(sched_ctx->description, sizeof(sched_ctx->description), "%s",
-                       scheduler->description);
+       strlcpy(sched_ctx->description, scheduler->description,
+               sizeof(sched_ctx->description));
 
        /* load scheduler instance operations functions */
        sched_ctx->ops.config_queue_pair = scheduler->ops->config_queue_pair;
diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c
index 8aca481c9..e988f1cb2 100644
--- a/drivers/event/opdl/opdl_ring.c
+++ b/drivers/event/opdl/opdl_ring.c
@@ -7,6 +7,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
+#include <rte_string_fns.h>
 #include <rte_branch_prediction.h>
 #include <rte_debug.h>
 #include <rte_lcore.h>
@@ -944,7 +945,7 @@ opdl_ring_create(const char *name, uint32_t num_slots, 
uint32_t slot_size,
 
        /* Initialise opdl_ring queue */
        memset(t, 0, sizeof(*t));
-       snprintf(t->name, sizeof(t->name), "%s", name);
+       strlcpy(t->name, name, sizeof(t->name));
        t->socket = socket;
        t->num_slots = num_slots;
        t->mask = num_slots - 1;
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c 
b/drivers/net/af_packet/rte_eth_af_packet.c
index 264cfc08f..99e13fe48 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -6,6 +6,7 @@
  * All rights reserved.
  */
 
+#include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_vdev.h>
@@ -442,7 +443,7 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        if (s < 0)
                return -EINVAL;
 
-       snprintf(ifr.ifr_name, IFNAMSIZ, "%s", internals->if_name);
+       strlcpy(ifr.ifr_name, internals->if_name, IFNAMSIZ);
        ret = ioctl(s, SIOCSIFMTU, &ifr);
        close(s);
 
@@ -462,7 +463,7 @@ eth_dev_change_flags(char *if_name, uint32_t flags, 
uint32_t mask)
        if (s < 0)
                return;
 
-       snprintf(ifr.ifr_name, IFNAMSIZ, "%s", if_name);
+       strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
        if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
                goto out;
        ifr.ifr_flags &= mask;
diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index c21003a04..ef861eea3 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -7,6 +7,7 @@
 #include <locale.h>
 #include <unistd.h>
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
 
@@ -347,7 +348,7 @@ set_arg(char *arg, char *val)
                        o->v.INT = atoll(val);
                        break;
                case OTSTRING:
-                       snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
+                       strlcpy(o->v.STR, val, ARK_MAX_STR_LEN);
                        break;
                }
                return 1;
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 2a2b428e2..2cae252d6 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -7,6 +7,7 @@
 #include <locale.h>
 #include <unistd.h>
 
+#include <rte_string_fns.h>
 #include <rte_eal.h>
 
 #include <rte_ethdev_driver.h>
@@ -329,7 +330,7 @@ pmd_set_arg(char *arg, char *val)
                        o->v.INT = atoll(val);
                        break;
                case OTSTRING:
-                       snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
+                       strlcpy(o->v.STR, val, ARK_MAX_STR_LEN);
                        break;
                }
                return 1;
diff --git a/drivers/net/atlantic/atl_ethdev.c 
b/drivers/net/atlantic/atl_ethdev.c
index 5c62d137b..8327863cd 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018 Aquantia Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_pci.h>
 
 #include "atl_ethdev.h"
@@ -755,8 +756,8 @@ atl_dev_xstats_get_names(struct rte_eth_dev *dev 
__rte_unused,
                return RTE_DIM(atl_xstats_tbl);
 
        for (i = 0; i < size && i < RTE_DIM(atl_xstats_tbl); i++)
-               snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, "%s",
-                       atl_xstats_tbl[i].name);
+               strlcpy(xstats_names[i].name, atl_xstats_tbl[i].name,
+                       RTE_ETH_XSTATS_NAME_SIZE);
 
        return i;
 }
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index cc7816dd5..1f2eb92b7 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -8,6 +8,7 @@
 #include "bnx2x.h"
 #include "bnx2x_rxtx.h"
 
+#include <rte_string_fns.h>
 #include <rte_dev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_alarm.h>
@@ -445,10 +446,9 @@ bnx2x_get_xstats_names(__rte_unused struct rte_eth_dev 
*dev,
 
        if (xstats_names != NULL)
                for (i = 0; i < stat_cnt; i++)
-                       snprintf(xstats_names[i].name,
-                               sizeof(xstats_names[i].name),
-                               "%s",
-                               bnx2x_xstats_strings[i].name);
+                       strlcpy(xstats_names[i].name,
+                               bnx2x_xstats_strings[i].name,
+                               sizeof(xstats_names[i].name));
 
        return stat_cnt;
 }
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index c16bf99da..cae3b9ea2 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -5,6 +5,7 @@
 
 #include <inttypes.h>
 
+#include <rte_string_fns.h>
 #include <rte_byteorder.h>
 
 #include "bnxt.h"
@@ -491,41 +492,36 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct 
rte_eth_dev *eth_dev,
                count = 0;
 
                for (i = 0; i < RTE_DIM(bnxt_rx_stats_strings); i++) {
-                       snprintf(xstats_names[count].name,
-                               sizeof(xstats_names[count].name),
-                               "%s",
-                               bnxt_rx_stats_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               bnxt_rx_stats_strings[i].name,
+                               sizeof(xstats_names[count].name));
                        count++;
                }
 
                for (i = 0; i < RTE_DIM(bnxt_tx_stats_strings); i++) {
-                       snprintf(xstats_names[count].name,
-                               sizeof(xstats_names[count].name),
-                               "%s",
-                               bnxt_tx_stats_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               bnxt_tx_stats_strings[i].name,
+                               sizeof(xstats_names[count].name));
                        count++;
                }
 
-               snprintf(xstats_names[count].name,
-                               sizeof(xstats_names[count].name),
-                               "%s",
-                               bnxt_func_stats_strings[4].name);
+               strlcpy(xstats_names[count].name,
+                       bnxt_func_stats_strings[4].name,
+                       sizeof(xstats_names[count].name));
                count++;
 
                for (i = 0; i < RTE_DIM(bnxt_rx_ext_stats_strings); i++) {
-                       snprintf(xstats_names[count].name,
-                                sizeof(xstats_names[count].name),
-                                "%s",
-                                bnxt_rx_ext_stats_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               bnxt_rx_ext_stats_strings[i].name,
+                               sizeof(xstats_names[count].name));
 
                        count++;
                }
 
                for (i = 0; i < RTE_DIM(bnxt_tx_ext_stats_strings); i++) {
-                       snprintf(xstats_names[count].name,
-                                sizeof(xstats_names[count].name),
-                                "%s",
-                                bnxt_tx_ext_stats_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               bnxt_tx_ext_stats_strings[i].name,
+                               sizeof(xstats_names[count].name));
 
                        count++;
                }
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index b1fac8fa7..2e043feb2 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <sys/syscall.h>
 
+#include <rte_string_fns.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
@@ -439,10 +440,9 @@ dpaa_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 
        if (xstats_names != NULL)
                for (i = 0; i < stat_cnt; i++)
-                       snprintf(xstats_names[i].name,
-                                sizeof(xstats_names[i].name),
-                                "%s",
-                                dpaa_xstats_strings[i].name);
+                       strlcpy(xstats_names[i].name,
+                               dpaa_xstats_strings[i].name,
+                               sizeof(xstats_names[i].name));
 
        return stat_cnt;
 }
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index b897e8ad4..d3a8f5bf4 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <stdarg.h>
 
+#include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
 #include <rte_byteorder.h>
@@ -1904,8 +1905,8 @@ static int eth_igb_xstats_get_names(__rte_unused struct 
rte_eth_dev *dev,
        /* Note: limit checked in rte_eth_xstats_names() */
 
        for (i = 0; i < IGB_NB_XSTATS; i++) {
-               snprintf(xstats_names[i].name, sizeof(xstats_names[i].name),
-                        "%s", rte_igb_stats_strings[i].name);
+               strlcpy(xstats_names[i].name, rte_igb_stats_strings[i].name,
+                       sizeof(xstats_names[i].name));
        }
 
        return IGB_NB_XSTATS;
@@ -1922,9 +1923,9 @@ static int eth_igb_xstats_get_names_by_id(struct 
rte_eth_dev *dev,
                        return IGB_NB_XSTATS;
 
                for (i = 0; i < IGB_NB_XSTATS; i++)
-                       snprintf(xstats_names[i].name,
-                                       sizeof(xstats_names[i].name),
-                                       "%s", rte_igb_stats_strings[i].name);
+                       strlcpy(xstats_names[i].name,
+                               rte_igb_stats_strings[i].name,
+                               sizeof(xstats_names[i].name));
 
                return IGB_NB_XSTATS;
 
@@ -2071,9 +2072,9 @@ static int eth_igbvf_xstats_get_names(__rte_unused struct 
rte_eth_dev *dev,
 
        if (xstats_names != NULL)
                for (i = 0; i < IGBVF_NB_XSTATS; i++) {
-                       snprintf(xstats_names[i].name,
-                               sizeof(xstats_names[i].name), "%s",
-                               rte_igbvf_stats_strings[i].name);
+                       strlcpy(xstats_names[i].name,
+                               rte_igbvf_stats_strings[i].name,
+                               sizeof(xstats_names[i].name));
                }
        return IGBVF_NB_XSTATS;
 }
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 08b1ab195..a55b4a719 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -31,6 +31,7 @@
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#include <rte_string_fns.h>
 #include <rte_ether.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_pci.h>
@@ -421,13 +422,11 @@ static void ena_config_host_info(struct ena_com_dev 
*ena_dev)
 
        host_info->os_type = ENA_ADMIN_OS_DPDK;
        host_info->kernel_ver = RTE_VERSION;
-       snprintf((char *)host_info->kernel_ver_str,
-                sizeof(host_info->kernel_ver_str),
-                "%s", rte_version());
+       strlcpy((char *)host_info->kernel_ver_str, rte_version(),
+               sizeof(host_info->kernel_ver_str));
        host_info->os_dist = RTE_VERSION;
-       snprintf((char *)host_info->os_dist_str,
-                sizeof(host_info->os_dist_str),
-                "%s", rte_version());
+       strlcpy((char *)host_info->os_dist_str, rte_version(),
+               sizeof(host_info->os_dist_str));
        host_info->driver_version =
                (DRV_MODULE_VER_MAJOR) |
                (DRV_MODULE_VER_MINOR << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) |
diff --git a/drivers/net/failsafe/failsafe_eal.c 
b/drivers/net/failsafe/failsafe_eal.c
index 74fd8e97c..820a915f7 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -3,6 +3,7 @@
  * Copyright 2017 Mellanox Technologies, Ltd
  */
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 
 #include "failsafe_private.h"
@@ -84,8 +85,9 @@ fs_bus_init(struct rte_eth_dev *dev)
                                snprintf(devstr, sizeof(devstr), "%s,%s",
                                         probed_da->name, probed_da->args);
                        else
-                               snprintf(devstr, sizeof(devstr), "%s",
-                                        rte_eth_devices[pid].device->name);
+                               strlcpy(devstr,
+                                       rte_eth_devices[pid].device->name,
+                                       sizeof(devstr));
                        ret = rte_devargs_parse(da, devstr);
                        if (ret) {
                                ERROR("Probed devargs parsing failed with code"
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index c49c872b6..7ae78e426 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2017 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_tailq.h>
 
@@ -1983,8 +1984,8 @@ int rte_pmd_i40e_get_ddp_info(uint8_t *pkg_buff, uint32_t 
pkg_size,
                tlv = (struct i40e_profile_tlv_section_record *)&proto[1];
                for (i = j = 0; i < nb_rec; j++) {
                        pinfo[j].proto_id = tlv->data[0];
-                       snprintf(pinfo[j].name, I40E_DDP_NAME_SIZE, "%s",
-                                (const char *)&tlv->data[1]);
+                       strlcpy(pinfo[j].name, (const char *)&tlv->data[1],
+                               I40E_DDP_NAME_SIZE);
                        i += tlv->len;
                        tlv = &tlv[tlv->len];
                }
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 1482cedb5..a06ebdadf 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_pci.h>
 
 #include <stdio.h>
@@ -3437,17 +3438,15 @@ static int ice_xstats_get_names(__rte_unused struct 
rte_eth_dev *dev,
 
        /* Get stats from ice_eth_stats struct */
        for (i = 0; i < ICE_NB_ETH_XSTATS; i++) {
-               snprintf(xstats_names[count].name,
-                        sizeof(xstats_names[count].name),
-                        "%s", ice_stats_strings[i].name);
+               strlcpy(xstats_names[count].name, ice_stats_strings[i].name,
+                       sizeof(xstats_names[count].name));
                count++;
        }
 
        /* Get individiual stats from ice_hw_port struct */
        for (i = 0; i < ICE_NB_HW_PORT_XSTATS; i++) {
-               snprintf(xstats_names[count].name,
-                        sizeof(xstats_names[count].name),
-                        "%s", ice_hw_port_strings[i].name);
+               strlcpy(xstats_names[count].name, ice_hw_port_strings[i].name,
+                       sizeof(xstats_names[count].name));
                count++;
        }
 
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index feec85634..b1be0c8b0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -11,6 +11,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 #include <netinet/in.h>
+#include <rte_string_fns.h>
 #include <rte_byteorder.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
@@ -3293,19 +3294,17 @@ static int ixgbe_dev_xstats_get_names(__rte_unused 
struct rte_eth_dev *dev,
 
                /* Extended stats from ixgbe_hw_stats */
                for (i = 0; i < IXGBE_NB_HW_STATS; i++) {
-                       snprintf(xstats_names[count].name,
-                               sizeof(xstats_names[count].name),
-                               "%s",
-                               rte_ixgbe_stats_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               rte_ixgbe_stats_strings[i].name,
+                               sizeof(xstats_names[count].name));
                        count++;
                }
 
                /* MACsec Stats */
                for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
-                       snprintf(xstats_names[count].name,
-                               sizeof(xstats_names[count].name),
-                               "%s",
-                               rte_ixgbe_macsec_strings[i].name);
+                       strlcpy(xstats_names[count].name,
+                               rte_ixgbe_macsec_strings[i].name,
+                               sizeof(xstats_names[count].name));
                        count++;
                }
 
@@ -3353,19 +3352,17 @@ static int ixgbe_dev_xstats_get_names_by_id(
 
                        /* Extended stats from ixgbe_hw_stats */
                        for (i = 0; i < IXGBE_NB_HW_STATS; i++) {
-                               snprintf(xstats_names[count].name,
-                                       sizeof(xstats_names[count].name),
-                                       "%s",
-                                       rte_ixgbe_stats_strings[i].name);
+                               strlcpy(xstats_names[count].name,
+                                       rte_ixgbe_stats_strings[i].name,
+                                       sizeof(xstats_names[count].name));
                                count++;
                        }
 
                        /* MACsec Stats */
                        for (i = 0; i < IXGBE_NB_MACSEC_STATS; i++) {
-                               snprintf(xstats_names[count].name,
-                                       sizeof(xstats_names[count].name),
-                                       "%s",
-                                       rte_ixgbe_macsec_strings[i].name);
+                               strlcpy(xstats_names[count].name,
+                                       rte_ixgbe_macsec_strings[i].name,
+                                       sizeof(xstats_names[count].name));
                                count++;
                        }
 
@@ -3422,9 +3419,9 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused 
struct rte_eth_dev *dev,
 
        if (xstats_names != NULL)
                for (i = 0; i < IXGBEVF_NB_XSTATS; i++)
-                       snprintf(xstats_names[i].name,
-                               sizeof(xstats_names[i].name),
-                               "%s", rte_ixgbevf_stats_strings[i].name);
+                       strlcpy(xstats_names[i].name,
+                               rte_ixgbevf_stats_strings[i].name,
+                               sizeof(xstats_names[i].name));
        return IXGBEVF_NB_XSTATS;
 }
 
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index 5e0222423..89f44737c 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -6,6 +6,7 @@
 #include <pthread.h>
 #include <unistd.h>
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_vdev.h>
 #include <rte_kni.h>
@@ -126,7 +127,7 @@ eth_kni_start(struct rte_eth_dev *dev)
        const char *name = dev->device->name + 4; /* remove net_ */
 
        mb_pool = internals->rx_queues[0].mb_pool;
-       snprintf(conf.name, RTE_KNI_NAMESIZE, "%s", name);
+       strlcpy(conf.name, name, RTE_KNI_NAMESIZE);
        conf.force_bind = 0;
        conf.group_id = port_id;
        conf.mbuf_size =
diff --git a/drivers/net/liquidio/lio_ethdev.c 
b/drivers/net/liquidio/lio_ethdev.c
index d13ab06c0..c9cabd65a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Cavium, Inc
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_ethdev_pci.h>
 #include <rte_cycles.h>
@@ -1781,8 +1782,8 @@ lio_dev_configure(struct rte_eth_dev *eth_dev)
                goto nic_config_fail;
        }
 
-       snprintf(lio_dev->firmware_version, LIO_FW_VERSION_LENGTH, "%s",
-                resp->cfg_info.lio_firmware_version);
+       strlcpy(lio_dev->firmware_version,
+               resp->cfg_info.lio_firmware_version, LIO_FW_VERSION_LENGTH);
 
        lio_swap_8B_data((uint64_t *)(&resp->cfg_info),
                         sizeof(struct octeon_if_cfg_info) >> 3);
diff --git a/drivers/net/mvneta/mvneta_ethdev.c 
b/drivers/net/mvneta/mvneta_ethdev.c
index 2d7666454..8923a1634 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -4,6 +4,7 @@
  * All rights reserved.
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_bus_vdev.h>
@@ -347,7 +348,7 @@ mvneta_dev_start(struct rte_eth_dev *dev)
        if (priv->ppio)
                return mvneta_dev_set_link_up(dev);
 
-       snprintf(match, sizeof(match), "%s", dev->data->name);
+       strlcpy(match, dev->data->name, sizeof(match));
        priv->ppio_params.match = match;
        priv->ppio_params.inqs_params.mtu = dev->data->mtu;
 
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index ab4c14e51..ce52f0901 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -4,6 +4,7 @@
  * All rights reserved.
  */
 
+#include <rte_string_fns.h>
 #include <rte_ethdev_driver.h>
 #include <rte_kvargs.h>
 #include <rte_log.h>
@@ -1388,8 +1389,8 @@ mrvl_xstats_get_names(struct rte_eth_dev *dev 
__rte_unused,
                return RTE_DIM(mrvl_xstats_tbl);
 
        for (i = 0; i < size && i < RTE_DIM(mrvl_xstats_tbl); i++)
-               snprintf(xstats_names[i].name, RTE_ETH_XSTATS_NAME_SIZE, "%s",
-                        mrvl_xstats_tbl[i].name);
+               strlcpy(xstats_names[i].name, mrvl_xstats_tbl[i].name,
+                       RTE_ETH_XSTATS_NAME_SIZE);
 
        return size;
 }
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0b2f305e1..b2fd2fd90 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -5,6 +5,7 @@
  */
 
 #include "qede_ethdev.h"
+#include <rte_string_fns.h>
 #include <rte_alarm.h>
 #include <rte_version.h>
 #include <rte_kvargs.h>
@@ -1591,27 +1592,24 @@ qede_get_xstats_names(struct rte_eth_dev *dev,
 
        if (xstats_names != NULL) {
                for (i = 0; i < RTE_DIM(qede_xstats_strings); i++) {
-                       snprintf(xstats_names[stat_idx].name,
-                               sizeof(xstats_names[stat_idx].name),
-                               "%s",
-                               qede_xstats_strings[i].name);
+                       strlcpy(xstats_names[stat_idx].name,
+                               qede_xstats_strings[i].name,
+                               sizeof(xstats_names[stat_idx].name));
                        stat_idx++;
                }
 
                if (ECORE_IS_BB(edev)) {
                        for (i = 0; i < RTE_DIM(qede_bb_xstats_strings); i++) {
-                               snprintf(xstats_names[stat_idx].name,
-                                       sizeof(xstats_names[stat_idx].name),
-                                       "%s",
-                                       qede_bb_xstats_strings[i].name);
+                               strlcpy(xstats_names[stat_idx].name,
+                                       qede_bb_xstats_strings[i].name,
+                                       sizeof(xstats_names[stat_idx].name));
                                stat_idx++;
                        }
                } else {
                        for (i = 0; i < RTE_DIM(qede_ah_xstats_strings); i++) {
-                               snprintf(xstats_names[stat_idx].name,
-                                       sizeof(xstats_names[stat_idx].name),
-                                       "%s",
-                                       qede_ah_xstats_strings[i].name);
+                               strlcpy(xstats_names[stat_idx].name,
+                                       qede_ah_xstats_strings[i].name,
+                                       sizeof(xstats_names[stat_idx].name));
                                stat_idx++;
                        }
                }
diff --git a/drivers/net/virtio/virtio_user/vhost_user.c 
b/drivers/net/virtio/virtio_user/vhost_user.c
index 2c6eba0a6..827a48ad6 100644
--- a/drivers/net/virtio/virtio_user/vhost_user.c
+++ b/drivers/net/virtio/virtio_user/vhost_user.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <errno.h>
 
+#include <rte_string_fns.h>
 #include <rte_fbarray.h>
 #include <rte_eal_memconfig.h>
 
@@ -424,7 +425,7 @@ vhost_user_setup(struct virtio_user_dev *dev)
 
        memset(&un, 0, sizeof(un));
        un.sun_family = AF_UNIX;
-       snprintf(un.sun_path, sizeof(un.sun_path), "%s", dev->path);
+       strlcpy(un.sun_path, dev->path, sizeof(un.sun_path));
 
        if (dev->is_server) {
                dev->listenfd = fd;
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c 
b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index b004bc13a..8e420bcbc 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -13,6 +13,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <rte_string_fns.h>
 #include <rte_eal_memconfig.h>
 
 #include "vhost.h"
@@ -429,7 +430,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char 
*path, int queues,
                     int server, int mrg_rxbuf, int in_order, int packed_vq)
 {
        pthread_mutex_init(&dev->mutex, NULL);
-       snprintf(dev->path, PATH_MAX, "%s", path);
+       strlcpy(dev->path, path, PATH_MAX);
        dev->started = 0;
        dev->max_queue_pairs = queues;
        dev->queue_pairs = 1; /* mq disabled by default */
diff --git a/examples/ethtool/lib/rte_ethtool.c 
b/examples/ethtool/lib/rte_ethtool.c
index e6a2e88c7..bf10139e7 100644
--- a/examples/ethtool/lib/rte_ethtool.c
+++ b/examples/ethtool/lib/rte_ethtool.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
+#include <rte_string_fns.h>
 #include <rte_version.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
@@ -43,10 +44,9 @@ rte_ethtool_get_drvinfo(uint16_t port_id, struct 
ethtool_drvinfo *drvinfo)
        memset(&dev_info, 0, sizeof(dev_info));
        rte_eth_dev_info_get(port_id, &dev_info);
 
-       snprintf(drvinfo->driver, sizeof(drvinfo->driver), "%s",
-               dev_info.driver_name);
-       snprintf(drvinfo->version, sizeof(drvinfo->version), "%s",
-               rte_version());
+       strlcpy(drvinfo->driver, dev_info.driver_name,
+               sizeof(drvinfo->driver));
+       strlcpy(drvinfo->version, rte_version(), sizeof(drvinfo->version));
        /* TODO: replace bus_info by rte_devargs.name */
        if (dev_info.device)
                bus = rte_bus_find_by_device(dev_info.device);
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 9982f07e9..06517b471 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -19,6 +19,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <rte_string_fns.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_common.h>
@@ -1199,8 +1200,7 @@ l2fwd_crypto_parse_args_long_options(struct 
l2fwd_crypto_options *options,
        if (strcmp(lgopts[option_index].name, "cdev_type") == 0) {
                retval = parse_cryptodev_type(&options->type, optarg);
                if (retval == 0)
-                       snprintf(options->string_type, MAX_STR_LEN,
-                               "%s", optarg);
+                       strlcpy(options->string_type, optarg, MAX_STR_LEN);
                return retval;
        }
 
diff --git a/examples/vm_power_manager/channel_manager.c 
b/examples/vm_power_manager/channel_manager.c
index 09bfa5c0d..0187f79ab 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -17,6 +17,7 @@
 #include <sys/socket.h>
 #include <sys/select.h>
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
 #include <rte_mempool.h>
@@ -415,7 +416,7 @@ add_all_channels(const char *vm_name)
                                !strncmp(dir->d_name, "..", 2))
                        continue;
 
-               snprintf(socket_name, sizeof(socket_name), "%s", dir->d_name);
+               strlcpy(socket_name, dir->d_name, sizeof(socket_name));
                remaining = socket_name;
                /* Extract vm_name from "<vm_name>.<channel_num>" */
                token = strsep(&remaining, ".");
@@ -562,8 +563,8 @@ add_host_channel(void)
                                "channel '%s'\n", socket_path);
                return 0;
        }
-       snprintf(chan_info->channel_path,
-                       sizeof(chan_info->channel_path), "%s", socket_path);
+       strlcpy(chan_info->channel_path, socket_path,
+               sizeof(chan_info->channel_path));
        if (setup_host_channel_info(&chan_info, 0) < 0) {
                rte_free(chan_info);
                return 0;
diff --git a/examples/vm_power_manager/channel_monitor.c 
b/examples/vm_power_manager/channel_monitor.c
index 7892d75de..74df0fe20 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -21,6 +21,7 @@
 #else
 #pragma message "Jansson dev libs unavailable, not including JSON parsing"
 #endif
+#include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
@@ -161,7 +162,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet 
*pkt)
                        strcpy(pkt->vm_name, json_string_value(value));
                } else if (!strcmp(key, "command")) {
                        char command[32];
-                       snprintf(command, 32, "%s", json_string_value(value));
+                       strlcpy(command, json_string_value(value), 32);
                        if (!strcmp(command, "power")) {
                                pkt->command = CPU_POWER;
                        } else if (!strcmp(command, "create")) {
@@ -175,7 +176,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet 
*pkt)
                        }
                } else if (!strcmp(key, "policy_type")) {
                        char command[32];
-                       snprintf(command, 32, "%s", json_string_value(value));
+                       strlcpy(command, json_string_value(value), 32);
                        if (!strcmp(command, "TIME")) {
                                pkt->policy_to_use = TIME;
                        } else if (!strcmp(command, "TRAFFIC")) {
@@ -191,7 +192,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet 
*pkt)
                        }
                } else if (!strcmp(key, "workload")) {
                        char command[32];
-                       snprintf(command, 32, "%s", json_string_value(value));
+                       strlcpy(command, json_string_value(value), 32);
                        if (!strcmp(command, "HIGH")) {
                                pkt->workload = HIGH;
                        } else if (!strcmp(command, "MEDIUM")) {
@@ -237,8 +238,9 @@ parse_json_to_pkt(json_t *element, struct channel_packet 
*pkt)
 
                        for (i = 0; i < size; i++) {
                                char mac[32];
-                               snprintf(mac, 32, "%s", json_string_value(
-                                               json_array_get(value, i)));
+                               strlcpy(mac,
+                                       json_string_value(json_array_get(value, 
i)),
+                                       32);
                                set_policy_mac(pkt, i, mac);
                        }
                        pkt->nb_mac_to_monitor = size;
@@ -250,7 +252,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet 
*pkt)
                                        (uint32_t)json_integer_value(value);
                } else if (!strcmp(key, "unit")) {
                        char unit[32];
-                       snprintf(unit, 32, "%s", json_string_value(value));
+                       strlcpy(unit, json_string_value(value), 32);
                        if (!strcmp(unit, "SCALE_UP")) {
                                pkt->unit = CPU_POWER_SCALE_UP;
                        } else if (!strcmp(unit, "SCALE_DOWN")) {
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index db7d3221e..c436a9bfd 100644
--- a/lib/librte_acl/rte_acl.c
+++ b/lib/librte_acl/rte_acl.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_acl.h>
 #include "acl.h"
 
@@ -249,7 +250,7 @@ rte_acl_create(const struct rte_acl_param *param)
                ctx->rule_sz = param->rule_size;
                ctx->socket_id = param->socket_id;
                ctx->alg = rte_acl_default_classify;
-               snprintf(ctx->name, sizeof(ctx->name), "%s", param->name);
+               strlcpy(ctx->name, param->name, sizeof(ctx->name));
 
                te->data = (void *) ctx;
 
diff --git a/lib/librte_bbdev/rte_bbdev.c b/lib/librte_bbdev/rte_bbdev.c
index c4cc18d98..a3ab5d973 100644
--- a/lib/librte_bbdev/rte_bbdev.c
+++ b/lib/librte_bbdev/rte_bbdev.c
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <stdbool.h>
 
+#include <rte_string_fns.h>
 #include <rte_compat.h>
 #include <rte_common.h>
 #include <rte_errno.h>
@@ -214,7 +215,7 @@ rte_bbdev_allocate(const char *name)
        bbdev->data->dev_id = dev_id;
        bbdev->state = RTE_BBDEV_INITIALIZED;
 
-       ret = snprintf(bbdev->data->name, RTE_BBDEV_NAME_MAX_LEN, "%s", name);
+       ret = strlcpy(bbdev->data->name, name, RTE_BBDEV_NAME_MAX_LEN);
        if ((ret < 0) || (ret >= RTE_BBDEV_NAME_MAX_LEN)) {
                rte_bbdev_log(ERR, "Copying device name \"%s\" failed", name);
                return NULL;
diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c
index 7d8c941ea..6110dba76 100644
--- a/lib/librte_cfgfile/rte_cfgfile.c
+++ b/lib/librte_cfgfile/rte_cfgfile.c
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <errno.h>
+#include <rte_string_fns.h>
 #include <rte_common.h>
 
 #include "rte_cfgfile.h"
@@ -113,9 +114,8 @@ _add_entry(struct rte_cfgfile_section *section, const char 
*entryname,
        struct rte_cfgfile_entry *curr_entry =
                                        &section->entries[section->num_entries];
 
-       snprintf(curr_entry->name, sizeof(curr_entry->name), "%s", entryname);
-       snprintf(curr_entry->value,
-                               sizeof(curr_entry->value), "%s", entryvalue);
+       strlcpy(curr_entry->name, entryname, sizeof(curr_entry->name));
+       strlcpy(curr_entry->value, entryvalue, sizeof(curr_entry->value));
        section->num_entries++;
 
        return 0;
@@ -341,8 +341,8 @@ rte_cfgfile_add_section(struct rte_cfgfile *cfg, const char 
*sectionname)
                cfg->allocated_sections += CFG_ALLOC_SECTION_BATCH;
        }
 
-       snprintf(cfg->sections[cfg->num_sections].name,
-                       sizeof(cfg->sections[0].name), "%s", sectionname);
+       strlcpy(cfg->sections[cfg->num_sections].name, sectionname,
+               sizeof(cfg->sections[0].name));
        cfg->sections[cfg->num_sections].num_entries = 0;
        cfg->num_sections++;
 
@@ -392,9 +392,8 @@ int rte_cfgfile_set_entry(struct rte_cfgfile *cfg, const 
char *sectionname,
 
        for (i = 0; i < curr_section->num_entries; i++)
                if (!strcmp(curr_section->entries[i].name, entryname)) {
-                       snprintf(curr_section->entries[i].value,
-                                       sizeof(curr_section->entries[i].value),
-                                                       "%s", entryvalue);
+                       strlcpy(curr_section->entries[i].value, entryvalue,
+                               sizeof(curr_section->entries[i].value));
                        return 0;
                }
        printf("Error - entry name doesn't exist\n");
@@ -468,8 +467,7 @@ rte_cfgfile_sections(struct rte_cfgfile *cfg, char 
*sections[],
        int i;
 
        for (i = 0; i < cfg->num_sections && i < max_sections; i++)
-               snprintf(sections[i], CFG_NAME_LEN, "%s",
-               cfg->sections[i].name);
+               strlcpy(sections[i], cfg->sections[i].name, CFG_NAME_LEN);
 
        return i;
 }
@@ -499,7 +497,7 @@ rte_cfgfile_section_num_entries_by_index(struct rte_cfgfile 
*cfg,
 
        const struct rte_cfgfile_section *sect = &(cfg->sections[index]);
 
-       snprintf(sectionname, CFG_NAME_LEN, "%s", sect->name);
+       strlcpy(sectionname, sect->name, CFG_NAME_LEN);
        return sect->num_entries;
 }
 int
@@ -526,7 +524,7 @@ rte_cfgfile_section_entries_by_index(struct rte_cfgfile 
*cfg, int index,
        if (index < 0 || index >= cfg->num_sections)
                return -1;
        sect = &cfg->sections[index];
-       snprintf(sectionname, CFG_NAME_LEN, "%s", sect->name);
+       strlcpy(sectionname, sect->name, CFG_NAME_LEN);
        for (i = 0; i < max_entries && i < sect->num_entries; i++)
                entries[i] = sect->entries[i];
        return i;
diff --git a/lib/librte_compressdev/rte_compressdev.c 
b/lib/librte_compressdev/rte_compressdev.c
index 338134bdf..afba584c9 100644
--- a/lib/librte_compressdev/rte_compressdev.c
+++ b/lib/librte_compressdev/rte_compressdev.c
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <inttypes.h>
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_eal.h>
 #include <rte_memzone.h>
@@ -252,8 +253,8 @@ rte_compressdev_pmd_allocate(const char *name, int 
socket_id)
 
                compressdev->data = compressdev_data;
 
-               snprintf(compressdev->data->name, RTE_COMPRESSDEV_NAME_MAX_LEN,
-                               "%s", name);
+               strlcpy(compressdev->data->name, name,
+                       RTE_COMPRESSDEV_NAME_MAX_LEN);
 
                compressdev->data->dev_id = dev_id;
                compressdev->data->socket_id = socket_id;
diff --git a/lib/librte_compressdev/rte_compressdev_pmd.c 
b/lib/librte_compressdev/rte_compressdev_pmd.c
index 95beb26ab..cc51d69c8 100644
--- a/lib/librte_compressdev/rte_compressdev_pmd.c
+++ b/lib/librte_compressdev/rte_compressdev_pmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017-2018 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_kvargs.h>
 #include <rte_eal.h>
@@ -21,7 +22,7 @@ rte_compressdev_pmd_parse_name_arg(const char *key 
__rte_unused,
        struct rte_compressdev_pmd_init_params *params = extra_args;
        int n;
 
-       n = snprintf(params->name, RTE_COMPRESSDEV_NAME_MAX_LEN, "%s", value);
+       n = strlcpy(params->name, value, RTE_COMPRESSDEV_NAME_MAX_LEN);
        if (n >= RTE_COMPRESSDEV_NAME_MAX_LEN)
                return -EINVAL;
 
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.c 
b/lib/librte_cryptodev/rte_cryptodev_pmd.c
index f03bdbd5e..091200412 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.c
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_malloc.h>
 
 #include "rte_cryptodev_pmd.h"
@@ -16,7 +17,7 @@ rte_cryptodev_pmd_parse_name_arg(const char *key __rte_unused,
        struct rte_cryptodev_pmd_init_params *params = extra_args;
        int n;
 
-       n = snprintf(params->name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s", value);
+       n = strlcpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
        if (n >= RTE_CRYPTODEV_NAME_MAX_LEN)
                return -EINVAL;
 
diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index 8dcfeb9b2..0c91024c4 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -16,6 +16,7 @@
 #include <sys/stat.h>
 #include <dirent.h>
 
+#include <rte_string_fns.h>
 #include <rte_eal.h>
 #include <rte_log.h>
 #include <rte_lcore.h>
@@ -139,7 +140,7 @@ eal_option_device_add(enum rte_devtype type, const char 
*optarg)
        }
 
        devopt->type = type;
-       ret = snprintf(devopt->arg, optlen, "%s", optarg);
+       ret = strlcpy(devopt->arg, optarg, optlen);
        if (ret < 0) {
                RTE_LOG(ERR, EAL, "Unable to copy device option\n");
                free(devopt);
diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c
index 1a97ece05..14e493bc3 100644
--- a/lib/librte_efd/rte_efd.c
+++ b/lib/librte_efd/rte_efd.c
@@ -9,6 +9,7 @@
 #include <stdarg.h>
 #include <sys/queue.h>
 
+#include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
@@ -591,7 +592,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, 
uint32_t key_len,
                goto error_unlock_exit;
        }
        table->keys = key_array;
-       snprintf(table->name, sizeof(table->name), "%s", name);
+       strlcpy(table->name, name, sizeof(table->name));
 
        RTE_LOG(DEBUG, EFD, "Creating an EFD table with %u chunks,"
                        " which potentially supports %u entries\n",
diff --git a/lib/librte_eventdev/rte_eventdev.c 
b/lib/librte_eventdev/rte_eventdev.c
index 4d4f07919..3bd571a87 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -13,6 +13,7 @@
 #include <sys/types.h>
 #include <sys/queue.h>
 
+#include <rte_string_fns.h>
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -1362,8 +1363,7 @@ rte_event_pmd_allocate(const char *name, int socket_id)
 
                eventdev->data = eventdev_data;
 
-               snprintf(eventdev->data->name, RTE_EVENTDEV_NAME_MAX_LEN,
-                               "%s", name);
+               strlcpy(eventdev->data->name, name, RTE_EVENTDEV_NAME_MAX_LEN);
 
                eventdev->data->dev_id = dev_id;
                eventdev->data->socket_id = socket_id;
diff --git a/lib/librte_flow_classify/rte_flow_classify.c 
b/lib/librte_flow_classify/rte_flow_classify.c
index fb652a2b7..24f7f7aa0 100644
--- a/lib/librte_flow_classify/rte_flow_classify.c
+++ b/lib/librte_flow_classify/rte_flow_classify.c
@@ -2,6 +2,7 @@
  * Copyright(c) 2017 Intel Corporation
  */
 
+#include <rte_string_fns.h>
 #include <rte_compat.h>
 #include <rte_flow_classify.h>
 #include "rte_flow_classify_parse.h"
@@ -285,8 +286,7 @@ rte_flow_classifier_create(struct 
rte_flow_classifier_params *params)
        }
 
        /* Save input parameters */
-       snprintf(cls->name, RTE_FLOW_CLASSIFIER_MAX_NAME_SZ, "%s",
-                       params->name);
+       strlcpy(cls->name, params->name, RTE_FLOW_CLASSIFIER_MAX_NAME_SZ);
 
        cls->socket_id = params->socket_id;
 
diff --git a/lib/librte_jobstats/rte_jobstats.c 
b/lib/librte_jobstats/rte_jobstats.c
index b64bc53bb..9b8fde5d5 100644
--- a/lib/librte_jobstats/rte_jobstats.c
+++ b/lib/librte_jobstats/rte_jobstats.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#include <rte_string_fns.h>
 #include <rte_errno.h>
 #include <rte_common.h>
 #include <rte_eal.h>
@@ -240,7 +241,7 @@ rte_jobstats_init(struct rte_jobstats *job, const char 
*name,
        job->target = target;
        job->update_period_cb = &default_update_function;
        rte_jobstats_reset(job);
-       snprintf(job->name, RTE_DIM(job->name), "%s", name == NULL ? "" : name);
+       strlcpy(job->name, name == NULL ? "" : name, RTE_DIM(job->name));
        job->context = NULL;
 
        return 0;
diff --git a/lib/librte_latencystats/rte_latencystats.c 
b/lib/librte_latencystats/rte_latencystats.c
index 5715549e4..06c62831b 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -7,6 +7,7 @@
 #include <stdbool.h>
 #include <math.h>
 
+#include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_log.h>
 #include <rte_cycles.h>
@@ -309,8 +310,8 @@ rte_latencystats_get_names(struct rte_metric_name *names, 
uint16_t size)
                return NUM_LATENCY_STATS;
 
        for (i = 0; i < NUM_LATENCY_STATS; i++)
-               snprintf(names[i].name, sizeof(names[i].name),
-                               "%s", lat_stats_strings[i].name);
+               strlcpy(names[i].name, lat_stats_strings[i].name,
+                       sizeof(names[i].name));
 
        return NUM_LATENCY_STATS;
 }
diff --git a/lib/librte_member/rte_member.c b/lib/librte_member/rte_member.c
index 702c01d3b..fd228f4ba 100644
--- a/lib/librte_member/rte_member.c
+++ b/lib/librte_member/rte_member.c
@@ -4,6 +4,7 @@
 
 #include <string.h>
 
+#include <rte_string_fns.h>
 #include <rte_eal.h>
 #include <rte_eal_memconfig.h>
 #include <rte_memory.h>
@@ -132,7 +133,7 @@ rte_member_create(const struct rte_member_parameters 
*params)
                RTE_MEMBER_LOG(ERR, "Create setsummary failed\n");
                goto error_unlock_exit;
        }
-       snprintf(setsum->name, sizeof(setsum->name), "%s", params->name);
+       strlcpy(setsum->name, params->name, sizeof(setsum->name));
        setsum->type = params->type;
        setsum->socket_id = params->socket_id;
        setsum->key_len = params->key_len;
diff --git a/lib/librte_mempool/rte_mempool_ops.c 
b/lib/librte_mempool/rte_mempool_ops.c
index a27e1fa51..e02eb702c 100644
--- a/lib/librte_mempool/rte_mempool_ops.c
+++ b/lib/librte_mempool/rte_mempool_ops.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_errno.h>
 #include <rte_dev.h>
@@ -51,7 +52,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h)
 
        ops_index = rte_mempool_ops_table.num_ops++;
        ops = &rte_mempool_ops_table.ops[ops_index];
-       snprintf(ops->name, sizeof(ops->name), "%s", h->name);
+       strlcpy(ops->name, h->name, sizeof(ops->name));
        ops->alloc = h->alloc;
        ops->free = h->free;
        ops->enqueue = h->enqueue;
diff --git a/lib/librte_power/power_acpi_cpufreq.c 
b/lib/librte_power/power_acpi_cpufreq.c
index 49325d0e0..5672c594e 100644
--- a/lib/librte_power/power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -12,6 +12,7 @@
 #include <signal.h>
 #include <limits.h>
 
+#include <rte_string_fns.h>
 #include <rte_memcpy.h>
 #include <rte_atomic.h>
 
@@ -159,7 +160,7 @@ power_set_governor_userspace(struct rte_power_info *pi)
                goto out;
        }
        /* Save the original governor */
-       snprintf(pi->governor_ori, sizeof(pi->governor_ori), "%s", buf);
+       strlcpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
 
        /* Write 'userspace' to the governor */
        val = fseek(f, 0, SEEK_SET);
diff --git a/lib/librte_power/power_pstate_cpufreq.c 
b/lib/librte_power/power_pstate_cpufreq.c
index 61ff8dbb0..336c13869 100644
--- a/lib/librte_power/power_pstate_cpufreq.c
+++ b/lib/librte_power/power_pstate_cpufreq.c
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <inttypes.h>
 
+#include <rte_string_fns.h>
 #include <rte_memcpy.h>
 #include <rte_atomic.h>
 
@@ -349,7 +350,7 @@ power_set_governor_performance(struct pstate_power_info *pi)
                goto out;
        }
        /* Save the original governor */
-       snprintf(pi->governor_ori, sizeof(pi->governor_ori), "%s", buf);
+       strlcpy(pi->governor_ori, buf, sizeof(pi->governor_ori));
 
        /* Write 'performance' to the governor */
        val = fseek(f, 0, SEEK_SET);
diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c
index 9f1e3592d..2b2f45d7c 100644
--- a/lib/librte_rawdev/rte_rawdev.c
+++ b/lib/librte_rawdev/rte_rawdev.c
@@ -13,6 +13,7 @@
 #include <sys/types.h>
 #include <sys/queue.h>
 
+#include <rte_string_fns.h>
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_debug.h>
@@ -508,7 +509,7 @@ rte_rawdev_pmd_allocate(const char *name, size_t 
dev_priv_size, int socket_id)
        rawdev->dev_id = dev_id;
        rawdev->socket_id = socket_id;
        rawdev->started = 0;
-       snprintf(rawdev->name, RTE_RAWDEV_NAME_MAX_LEN, "%s", name);
+       strlcpy(rawdev->name, name, RTE_RAWDEV_NAME_MAX_LEN);
 
        rawdev->attached = RTE_RAWDEV_ATTACHED;
        rawdev_globals.nb_devs++;
diff --git a/lib/librte_reorder/rte_reorder.c b/lib/librte_reorder/rte_reorder.c
index ecf539d22..b15328b2e 100644
--- a/lib/librte_reorder/rte_reorder.c
+++ b/lib/librte_reorder/rte_reorder.c
@@ -5,6 +5,7 @@
 #include <inttypes.h>
 #include <string.h>
 
+#include <rte_string_fns.h>
 #include <rte_log.h>
 #include <rte_mbuf.h>
 #include <rte_eal_memconfig.h>
@@ -82,7 +83,7 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int 
bufsize,
        }
 
        memset(b, 0, bufsize);
-       snprintf(b->name, sizeof(b->name), "%s", name);
+       strlcpy(b->name, name, sizeof(b->name));
        b->memsize = bufsize;
        b->order_buf.size = b->ready_buf.size = size;
        b->order_buf.mask = b->ready_buf.mask = size - 1;
@@ -161,7 +162,7 @@ rte_reorder_reset(struct rte_reorder_buffer *b)
        char name[RTE_REORDER_NAMESIZE];
 
        rte_reorder_free_mbufs(b);
-       snprintf(name, sizeof(name), "%s", b->name);
+       strlcpy(name, b->name, sizeof(name));
        /* No error checking as current values should be valid */
        rte_reorder_init(b, b->memsize, name, b->order_buf.size);
 }
-- 
2.20.1

Reply via email to