Bugzilla ID: 353
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Muhammad Bilal <[email protected]>
---
lib/librte_mbuf/rte_mbuf_pool_ops.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf_pool_ops.c
b/lib/librte_mbuf/rte_mbuf_pool_ops.c
index 5722976fe..00186aa15 100644
--- a/lib/librte_mbuf/rte_mbuf_pool_ops.c
+++ b/lib/librte_mbuf/rte_mbuf_pool_ops.c
@@ -13,8 +13,10 @@ int
rte_mbuf_set_platform_mempool_ops(const char *ops_name)
{
const struct rte_memzone *mz;
-
- if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+ size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
+ if (len == 0)
+ return -EINVAL;
+ if (len == RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
mz = rte_memzone_lookup("mbuf_platform_pool_ops");
@@ -50,8 +52,10 @@ int
rte_mbuf_set_user_mempool_ops(const char *ops_name)
{
const struct rte_memzone *mz;
-
- if (strlen(ops_name) >= RTE_MEMPOOL_OPS_NAMESIZE)
+ size_t len = strnlen(ops_name, RTE_MEMPOOL_OPS_NAMESIZE);
+ if (len == 0)
+ return -EINVAL;
+ if (len == RTE_MEMPOOL_OPS_NAMESIZE)
return -ENAMETOOLONG;
mz = rte_memzone_lookup("mbuf_user_pool_ops");
--
2.17.1