[dpdk-dev,v4,17/18] app/test-bbdev: strcpy ok for allocated string

Message ID 152600320129.53146.5983894189916318956.stgit@localhost.localdomain (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andy Green May 11, 2018, 1:46 a.m. UTC
  Signed-off-by: Andy Green <andy@warmcat.com>
---
 app/test-bbdev/test_bbdev_vector.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo May 11, 2018, 12:55 p.m. UTC | #1
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andy Green

> Sent: Friday, May 11, 2018 2:47 AM

> To: dev@dpdk.org

> Subject: [dpdk-dev] [PATCH v4 17/18] app/test-bbdev: strcpy ok for allocated

> string

> 

> Signed-off-by: Andy Green <andy@warmcat.com>

> ---

>  app/test-bbdev/test_bbdev_vector.c |    2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-

> bbdev/test_bbdev_vector.c

> index a37e35f4d..c574f2135 100644

> --- a/app/test-bbdev/test_bbdev_vector.c

> +++ b/app/test-bbdev/test_bbdev_vector.c

> @@ -892,7 +892,7 @@ test_bbdev_vector_read(const char *filename,

>  		}

> 

>  		memset(entry, 0, strlen(line) + 1);

> -		strncpy(entry, line, strlen(line));

> +		strcpy(entry, line);


Better to use strlcpy(entry,line,sizeof(entry)) and remove the memset call.

Missing fixes line and CC stable:

Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")
Cc: stable@dpdk.org
  

Patch

diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c
index a37e35f4d..c574f2135 100644
--- a/app/test-bbdev/test_bbdev_vector.c
+++ b/app/test-bbdev/test_bbdev_vector.c
@@ -892,7 +892,7 @@  test_bbdev_vector_read(const char *filename,
 		}
 
 		memset(entry, 0, strlen(line) + 1);
-		strncpy(entry, line, strlen(line));
+		strcpy(entry, line);
 
 		/* check if entry ends with , or = */
 		if (entry[strlen(entry) - 1] == ','