summaryrefslogtreecommitdiff
path: root/lib/librte_acl
diff options
context:
space:
mode:
authorBruce Richardson <bruce.richardson@intel.com>2019-04-03 15:45:05 +0100
committerThomas Monjalon <thomas@monjalon.net>2019-04-04 22:46:05 +0200
commit6723c0fc7207ca4416822b170b1485a78aa47c7c (patch)
treefef3c6683019dcdf1403761e047308af49f49f8f /lib/librte_acl
parentf9acaf84e923066344bd3467e4703da66f1f23a8 (diff)
downloaddpdk-6723c0fc7207ca4416822b170b1485a78aa47c7c.zip
dpdk-6723c0fc7207ca4416822b170b1485a78aa47c7c.tar.gz
dpdk-6723c0fc7207ca4416822b170b1485a78aa47c7c.tar.xz
replace snprintf with strlcpy
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 <bruce.richardson@intel.com>
Diffstat (limited to 'lib/librte_acl')
-rw-r--r--lib/librte_acl/rte_acl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index db7d322..c436a9b 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;