From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB3C4A057B for ; Tue, 7 Apr 2020 09:56:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A46801BEE3; Tue, 7 Apr 2020 09:56:54 +0200 (CEST) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by dpdk.org (Postfix) with ESMTP id DBE7B2BE2 for ; Tue, 7 Apr 2020 09:56:51 +0200 (CEST) Received: by mail-lf1-f65.google.com with SMTP id w145so1621042lff.3 for ; Tue, 07 Apr 2020 00:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t6BUceYtbJnzsRoMKhdU2tXDuQcuNWZq64zD40p3hb0=; b=x00+abWsmDWxuEWx1KxQx3ybfq42LeZe1EZ5aGowN9YtEKg5mjiJbjvF+/NwXXTllD 8pJwIAItw3IF/aQjB7Us3In5nibjRjjU67HSG45wWaRQqdXXHvdVdPxpKpRwbf07C8f4 cleCw7rfgzR81i/ideg1my41x4lyRcQyuOtjram6CaK9A291CtfTWHf0p5+fNbZxjOhv B44exjShGS5GrCkBuqYtfINzghJSndIpSzcyb6Sgt3xb/GCgniC7Z6CcLpzR35QpWMOa ohXbrfmTm/RdRg3Hpc6hubmwqD7Uyfh86Txy4kWBIivLJflXsch7njGXGmb4sHcNIUD8 tzkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=t6BUceYtbJnzsRoMKhdU2tXDuQcuNWZq64zD40p3hb0=; b=m26i2d7MfwxT/5DX3SZPIc0iNVAznHCfEtgJ6strOZV3Jc0u+9x555qRGgx4Gr2QfI oKCti7jdQxV29SnIMu6HGPh0CWHca8QvEMkmgjpi7mT1FwdP7oDwiYTWuYVtLjC5Ma2P WpwT1INwksrcxNg+0MPvneAJiLQVrcKFm2CBqLQJbcsaWi/FYQMy64dnUe5l90n0M4PX 9Ckyxm8cfPmr2UgphMWLCxAzLxcdQ1Ga6XfpewBIVodo0fpAr07yWHzzRRWA0SuCWS+3 zib0wFEdkeMLSOZj8YSGfFTwKt+2xFX3zFCSMFQ1HVrRb7aBAvL38gY2xZ/iFmk+LY80 X+wA== X-Gm-Message-State: AGi0PuZwhT1P5Y2CvDUWNcJnvHF8s7o3i2CXjVViz21aXj/WfmoCc13O JVSHjCcmwM0cF39TpN2K+yMVEA== X-Google-Smtp-Source: APiQypI+aIFVuyc5GAIk7Bxg0Pb6ZOXfi1Toik+dRlmSbw8FyDNPsBxZjDgR0970AEpyiUZJSvn7RQ== X-Received: by 2002:a19:501a:: with SMTP id e26mr717343lfb.93.1586246211346; Tue, 07 Apr 2020 00:56:51 -0700 (PDT) Received: from localhost.localdomain ([111.119.188.2]) by smtp.gmail.com with ESMTPSA id o16sm11754482ljp.53.2020.04.07.00.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 00:56:50 -0700 (PDT) From: Muhammad Bilal To: hemant.agrawal@nxp.com, olivier.matz@6wind.com, stephen@networkplumber.org Cc: dev@dpdk.org, Muhammad Bilal , stable@dpdk.org Date: Tue, 7 Apr 2020 12:56:13 +0500 Message-Id: <20200407075613.29273-1-m.bilal@emumba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200406113020.8074-1-m.bilal@emumba.com> References: <20200406113020.8074-1-m.bilal@emumba.com> Subject: [dpdk-stable] [PATCH v2] putting null checks on ops_name X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Bugzilla ID: 353 Cc: dev@dpdk.org Cc: stable@dpdk.org Cc: hemant.agrawal@nxp.com Signed-off-by: Muhammad Bilal --- 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