From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v6 16/16] app/test-bbdev: strcpy ok for allocated string Date: Mon, 14 May 2018 22:03:45 +0100 Message-ID: <60fdf3eb-039e-57eb-4863-0f3c291b01c7@intel.com> References: <152627394448.52758.15834703911138407294.stgit@localhost.localdomain> <152627407240.52758.12345283817005640967.stgit@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Andy Green , dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 161871CC0E for ; Mon, 14 May 2018 23:03:48 +0200 (CEST) In-Reply-To: <152627407240.52758.12345283817005640967.stgit@localhost.localdomain> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 5/14/2018 6:01 AM, Andy Green wrote: .../app/test-bbdev/test_bbdev_vector.c:917:5: error: ‘strncat’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncat(entry, line, strlen(line)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") > Cc: stable@dpdk.org > Signed-off-by: Andy Green Reviewed-by: Ferruh Yigit > --- > app/test-bbdev/test_bbdev_vector.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c > index c574f2135..81b8ee78f 100644 > --- a/app/test-bbdev/test_bbdev_vector.c > +++ b/app/test-bbdev/test_bbdev_vector.c > @@ -891,7 +891,6 @@ test_bbdev_vector_read(const char *filename, > goto exit; > } > > - memset(entry, 0, strlen(line) + 1); This one seems belong to 15/16, will move there. > strcpy(entry, line); > > /* check if entry ends with , or = */ > @@ -914,7 +913,8 @@ test_bbdev_vector_read(const char *filename, > } > > entry = entry_extended; > - strncat(entry, line, strlen(line)); > + /* entry has been allocated accordingly */ > + strcpy(&entry[strlen(entry)], line); > > if (entry[strlen(entry) - 1] != ',') > break; >