DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable
@ 2018-04-18 16:58 Reshma Pattan
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Reshma Pattan @ 2018-04-18 16:58 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, Reshma Pattan

Using uninitialized value p.thread_id when calling kni_create.
Initialize the kni_params object to 0.

Coverity issue: 272569
Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ip_pipeline/cli.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 199a31ff8..575e176c1 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -651,6 +651,7 @@ cmd_kni(char **tokens,
 	char *name;
 	struct kni *kni;
 
+	memset(&p, 0, sizeof(p));
 	if ((n_tokens != 6) && (n_tokens != 8)) {
 		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
 		return;
-- 
2.14.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-18 16:58 [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Reshma Pattan
@ 2018-04-18 16:58 ` Reshma Pattan
  2018-04-19  8:36   ` Singh, Jasvinder
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak Reshma Pattan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 25+ messages in thread
From: Reshma Pattan @ 2018-04-18 16:58 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, Reshma Pattan

Copying source string of length equal to sizeof(kni->name)
will not append the NULL to destination string.

Using strlcpy in place of strncpy fixes this issue as
strlcpy guarantees NULL termination.

Coverity issue: 272562
Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ip_pipeline/kni.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c
index ed5f8942e..7e5ff0543 100644
--- a/examples/ip_pipeline/kni.c
+++ b/examples/ip_pipeline/kni.c
@@ -7,6 +7,7 @@
 
 #include <rte_ethdev.h>
 #include <rte_bus_pci.h>
+#include <rte_string_fns.h>
 
 #include "kni.h"
 #include "mempool.h"
@@ -153,7 +154,7 @@ kni_create(const char *name, struct kni_params *params)
 		return NULL;
 
 	/* Node fill in */
-	strncpy(kni->name, name, sizeof(kni->name));
+	strlcpy(kni->name, name, sizeof(kni->name));
 	kni->k = k;
 
 	/* Node add to list */
-- 
2.14.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak
  2018-04-18 16:58 [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Reshma Pattan
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
@ 2018-04-18 16:58 ` Reshma Pattan
  2018-04-19  8:37   ` Singh, Jasvinder
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
  2018-04-19  8:37 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Singh, Jasvinder
  3 siblings, 1 reply; 25+ messages in thread
From: Reshma Pattan @ 2018-04-18 16:58 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, Reshma Pattan

Close tap device fd before returning upon failures.

Coverity issue: 272576
Fixes: 2f74ae28e2 ("examples/ip_pipeline: add tap object")
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ip_pipeline/tap.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/examples/ip_pipeline/tap.c b/examples/ip_pipeline/tap.c
index 5b3403218..a0f60867f 100644
--- a/examples/ip_pipeline/tap.c
+++ b/examples/ip_pipeline/tap.c
@@ -76,14 +76,17 @@ tap_create(const char *name)
 	snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
 
 	status = ioctl(fd, TUNSETIFF, (void *) &ifr);
-	if (status < 0)
+	if (status < 0) {
+		close(fd);
 		return NULL;
+	}
 
 	/* Node allocation */
 	tap = calloc(1, sizeof(struct tap));
-	if (tap == NULL)
+	if (tap == NULL) {
+		close(fd);
 		return NULL;
-
+	}
 	/* Node fill in */
 	strncpy(tap->name, name, sizeof(tap->name));
 	tap->fd = fd;
-- 
2.14.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-18 16:58 [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Reshma Pattan
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak Reshma Pattan
@ 2018-04-18 16:58 ` Reshma Pattan
  2018-04-19  8:35   ` Singh, Jasvinder
  2018-04-19  8:37 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Singh, Jasvinder
  3 siblings, 1 reply; 25+ messages in thread
From: Reshma Pattan @ 2018-04-18 16:58 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, Reshma Pattan

Copying source string of length equal to sizeof(profile->name)
will not append the NULL in destination.

Using strlcpy in place of strncpy fixes this issue as
strlcpy guarantees NULL termination.

Coverity issue: 272580
Fixes: 719374345c ("examples/ip_pipeline: add action profile objects")
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 examples/ip_pipeline/action.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
index 77a04fe19..d2cd7286c 100644
--- a/examples/ip_pipeline/action.c
+++ b/examples/ip_pipeline/action.c
@@ -6,6 +6,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <rte_string_fns.h>
+
 #include "action.h"
 #include "hash_func.h"
 
@@ -345,7 +347,7 @@ table_action_profile_create(const char *name,
 	}
 
 	/* Node fill in */
-	strncpy(profile->name, name, sizeof(profile->name));
+	strlcpy(profile->name, name, sizeof(profile->name));
 	memcpy(&profile->params, params, sizeof(*params));
 	profile->ap = ap;
 
-- 
2.14.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
@ 2018-04-19  8:35   ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19  8:35 UTC (permalink / raw)
  To: Pattan, Reshma, dev



> -----Original Message-----
> From: Pattan, Reshma
> Sent: Wednesday, April 18, 2018 5:58 PM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> 
> Copying source string of length equal to sizeof(profile->name) will not append
> the NULL in destination.
> 
> Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees NULL
> termination.
> 
> Coverity issue: 272580
> Fixes: 719374345c ("examples/ip_pipeline: add action profile objects")
> CC: jasvinder.singh@intel.com
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/ip_pipeline/action.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
> index 77a04fe19..d2cd7286c 100644
> --- a/examples/ip_pipeline/action.c
> +++ b/examples/ip_pipeline/action.c
> @@ -6,6 +6,8 @@
>  #include <stdlib.h>
>  #include <string.h>
> 
> +#include <rte_string_fns.h>
> +
>  #include "action.h"
>  #include "hash_func.h"
> 
> @@ -345,7 +347,7 @@ table_action_profile_create(const char *name,
>  	}
> 
>  	/* Node fill in */
> -	strncpy(profile->name, name, sizeof(profile->name));
> +	strlcpy(profile->name, name, sizeof(profile->name));
>  	memcpy(&profile->params, params, sizeof(*params));
>  	profile->ap = ap;
> 
> --
> 2.14.3
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
@ 2018-04-19  8:36   ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19  8:36 UTC (permalink / raw)
  To: Pattan, Reshma, dev



> -----Original Message-----
> From: Pattan, Reshma
> Sent: Wednesday, April 18, 2018 5:58 PM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> 
> Copying source string of length equal to sizeof(kni->name) will not append the
> NULL to destination string.
> 
> Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees NULL
> termination.
> 
> Coverity issue: 272562
> Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
> CC: jasvinder.singh@intel.com
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/ip_pipeline/kni.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c index
> ed5f8942e..7e5ff0543 100644
> --- a/examples/ip_pipeline/kni.c
> +++ b/examples/ip_pipeline/kni.c
> @@ -7,6 +7,7 @@
> 
>  #include <rte_ethdev.h>
>  #include <rte_bus_pci.h>
> +#include <rte_string_fns.h>
> 
>  #include "kni.h"
>  #include "mempool.h"
> @@ -153,7 +154,7 @@ kni_create(const char *name, struct kni_params
> *params)
>  		return NULL;
> 
>  	/* Node fill in */
> -	strncpy(kni->name, name, sizeof(kni->name));
> +	strlcpy(kni->name, name, sizeof(kni->name));
>  	kni->k = k;
> 
>  	/* Node add to list */
> --
> 2.14.3

Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak Reshma Pattan
@ 2018-04-19  8:37   ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19  8:37 UTC (permalink / raw)
  To: Pattan, Reshma, dev



> -----Original Message-----
> From: Pattan, Reshma
> Sent: Wednesday, April 18, 2018 5:58 PM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH] examples/ip_pipipeline: fix resource leak
> 
> Close tap device fd before returning upon failures.
> 
> Coverity issue: 272576
> Fixes: 2f74ae28e2 ("examples/ip_pipeline: add tap object")
> CC: jasvinder.singh@intel.com
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/ip_pipeline/tap.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/ip_pipeline/tap.c b/examples/ip_pipeline/tap.c index
> 5b3403218..a0f60867f 100644
> --- a/examples/ip_pipeline/tap.c
> +++ b/examples/ip_pipeline/tap.c
> @@ -76,14 +76,17 @@ tap_create(const char *name)
>  	snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
> 
>  	status = ioctl(fd, TUNSETIFF, (void *) &ifr);
> -	if (status < 0)
> +	if (status < 0) {
> +		close(fd);
>  		return NULL;
> +	}
> 
>  	/* Node allocation */
>  	tap = calloc(1, sizeof(struct tap));
> -	if (tap == NULL)
> +	if (tap == NULL) {
> +		close(fd);
>  		return NULL;
> -
> +	}
>  	/* Node fill in */
>  	strncpy(tap->name, name, sizeof(tap->name));
>  	tap->fd = fd;
> --
> 2.14.3
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable
  2018-04-18 16:58 [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Reshma Pattan
                   ` (2 preceding siblings ...)
  2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
@ 2018-04-19  8:37 ` Singh, Jasvinder
  3 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19  8:37 UTC (permalink / raw)
  To: Pattan, Reshma, dev



> -----Original Message-----
> From: Pattan, Reshma
> Sent: Wednesday, April 18, 2018 5:58 PM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable
> 
> Using uninitialized value p.thread_id when calling kni_create.
> Initialize the kni_params object to 0.
> 
> Coverity issue: 272569
> Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
> CC: jasvinder.singh@intel.com
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  examples/ip_pipeline/cli.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index
> 199a31ff8..575e176c1 100644
> --- a/examples/ip_pipeline/cli.c
> +++ b/examples/ip_pipeline/cli.c
> @@ -651,6 +651,7 @@ cmd_kni(char **tokens,
>  	char *name;
>  	struct kni *kni;
> 
> +	memset(&p, 0, sizeof(p));
>  	if ((n_tokens != 6) && (n_tokens != 8)) {
>  		snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
>  		return;
> --
> 2.14.3

Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-05-08 19:51   ` Bruce Richardson
@ 2018-05-09  9:26     ` Dumitrescu, Cristian
  0 siblings, 0 replies; 25+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-09  9:26 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: Zhang, Roy Fan, dev, Singh, Jasvinder



> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, May 8, 2018 8:51 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org; Singh,
> Jasvinder <jasvinder.singh@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null
> terminated
> 
> On Tue, May 08, 2018 at 02:28:25PM +0000, Dumitrescu, Cristian wrote:
> >
> >
> > > -----Original Message-----
> > > From: Zhang, Roy Fan
> > > Sent: Monday, April 16, 2018 12:03 PM
> > > To: dev@dpdk.org
> > > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh,
> Jasvinder
> > > <jasvinder.singh@intel.com>
> > > Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> > >
> > > Coverity issue: 272572
> > > Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")
> > >
> > > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > > ---
> > >  examples/ip_pipeline/action.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/examples/ip_pipeline/action.c
> b/examples/ip_pipeline/action.c
> > > index 77a04fe19..91011ebe8 100644
> > > --- a/examples/ip_pipeline/action.c
> > > +++ b/examples/ip_pipeline/action.c
> > > @@ -133,7 +133,7 @@ port_in_action_profile_create(const char
> *name,
> > >  	}
> > >
> > >  	/* Node fill in */
> > > -	strncpy(profile->name, name, sizeof(profile->name));
> > > +	strncpy(profile->name, name, sizeof(profile->name) - 1);
> > >  	memcpy(&profile->params, params, sizeof(*params));
> > >  	profile->ap = ap;
> > >
> > > --
> > > 2.13.6
> >
> > Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>
> >
> > Applied to next-pipeline tree, thanks!
> 
> This is not a correct fix, and the code is still broken. However, I see
> that you have actually applied the correct v2 patch to the tree, so no big
> deal. It's probably best to reply to the correct patch confirming it's
> applied, though.
> 
> /Bruce

Yes, the right patch (v2) was applied, the wrong email was replied.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-05-08 14:28 ` Dumitrescu, Cristian
@ 2018-05-08 19:51   ` Bruce Richardson
  2018-05-09  9:26     ` Dumitrescu, Cristian
  0 siblings, 1 reply; 25+ messages in thread
From: Bruce Richardson @ 2018-05-08 19:51 UTC (permalink / raw)
  To: Dumitrescu, Cristian; +Cc: Zhang, Roy Fan, dev, Singh, Jasvinder

On Tue, May 08, 2018 at 02:28:25PM +0000, Dumitrescu, Cristian wrote:
> 
> 
> > -----Original Message-----
> > From: Zhang, Roy Fan
> > Sent: Monday, April 16, 2018 12:03 PM
> > To: dev@dpdk.org
> > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> > <jasvinder.singh@intel.com>
> > Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> > 
> > Coverity issue: 272572
> > Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")
> > 
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> > ---
> >  examples/ip_pipeline/action.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
> > index 77a04fe19..91011ebe8 100644
> > --- a/examples/ip_pipeline/action.c
> > +++ b/examples/ip_pipeline/action.c
> > @@ -133,7 +133,7 @@ port_in_action_profile_create(const char *name,
> >  	}
> > 
> >  	/* Node fill in */
> > -	strncpy(profile->name, name, sizeof(profile->name));
> > +	strncpy(profile->name, name, sizeof(profile->name) - 1);
> >  	memcpy(&profile->params, params, sizeof(*params));
> >  	profile->ap = ap;
> > 
> > --
> > 2.13.6
> 
> Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>
> 
> Applied to next-pipeline tree, thanks!

This is not a correct fix, and the code is still broken. However, I see
that you have actually applied the correct v2 patch to the tree, so no big
deal. It's probably best to reply to the correct patch confirming it's
applied, though.

/Bruce

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-16 11:02 Fan Zhang
  2018-04-16 13:17 ` Bruce Richardson
@ 2018-05-08 14:28 ` Dumitrescu, Cristian
  2018-05-08 19:51   ` Bruce Richardson
  1 sibling, 1 reply; 25+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-08 14:28 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, April 16, 2018 12:03 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> 
> Coverity issue: 272572
> Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  examples/ip_pipeline/action.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
> index 77a04fe19..91011ebe8 100644
> --- a/examples/ip_pipeline/action.c
> +++ b/examples/ip_pipeline/action.c
> @@ -133,7 +133,7 @@ port_in_action_profile_create(const char *name,
>  	}
> 
>  	/* Node fill in */
> -	strncpy(profile->name, name, sizeof(profile->name));
> +	strncpy(profile->name, name, sizeof(profile->name) - 1);
>  	memcpy(&profile->params, params, sizeof(*params));
>  	profile->ap = ap;
> 
> --
> 2.13.6

Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>

Applied to next-pipeline tree, thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated.
  2018-04-16 10:26 Fan Zhang
@ 2018-05-08 14:27 ` Dumitrescu, Cristian
  0 siblings, 0 replies; 25+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-08 14:27 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Monday, April 16, 2018 11:26 AM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated.
> 
> Coverity issue: 272563
> Fixes: 8245472c58c8 ("examples/ip_pipeline: add sw queue object")
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  examples/ip_pipeline/swq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/swq.c b/examples/ip_pipeline/swq.c
> index c11bbf27e..be78704c1 100644
> --- a/examples/ip_pipeline/swq.c
> +++ b/examples/ip_pipeline/swq.c
> @@ -64,7 +64,7 @@ swq_create(const char *name, struct swq_params
> *params)
>  	}
> 
>  	/* Node fill in */
> -	strncpy(swq->name, name, sizeof(swq->name));
> +	strncpy(swq->name, name, sizeof(swq->name) - 1);
>  	swq->r = r;
> 
>  	/* Node add to list */
> --
> 2.13.6

Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>

Applied to next-pipeline tree, thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-19 11:01 Kevin Laatz
@ 2018-04-19 15:34 ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19 15:34 UTC (permalink / raw)
  To: Laatz, Kevin, dev; +Cc: Dumitrescu, Cristian



> -----Original Message-----
> From: Laatz, Kevin
> Sent: Thursday, April 19, 2018 12:01 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Laatz, Kevin
> <kevin.laatz@intel.com>; Singh, Jasvinder <jasvinder.singh@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> 
> The destination string may not have a NULL termination if the source's string is
> equal to the sizeof(mempool->name).
> 
> Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees NULL
> termination.
> 
> Coverity issue: 272588
> Fixes: 6bfe74f8c93e ("examples/ip_pipeline: add mempool object")
> Cc: jasvinder.singh@intel.com
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
>  examples/ip_pipeline/mempool.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/mempool.c
> b/examples/ip_pipeline/mempool.c index 33b9243..f5d2a7d 100644
> --- a/examples/ip_pipeline/mempool.c
> +++ b/examples/ip_pipeline/mempool.c
> @@ -6,6 +6,7 @@
>  #include <string.h>
> 
>  #include <rte_mbuf.h>
> +#include <rte_string_fns.h>
> 
>  #include "mempool.h"
> 
> @@ -70,7 +71,7 @@ mempool_create(const char *name, struct
> mempool_params *params)
>  	}
> 
>  	/* Node fill in */
> -	strncpy(mempool->name, name, sizeof(mempool->name));
> +	strlcpy(mempool->name, name, sizeof(mempool->name));
>  	mempool->m = m;
>  	mempool->buffer_size = params->buffer_size;
> 
> --
> 2.9.5

Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-19 11:03 [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Kevin Laatz
@ 2018-04-19 15:33 ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-19 15:33 UTC (permalink / raw)
  To: Laatz, Kevin, dev; +Cc: Dumitrescu, Cristian



> -----Original Message-----
> From: Laatz, Kevin
> Sent: Thursday, April 19, 2018 12:03 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Laatz, Kevin
> <kevin.laatz@intel.com>; Singh, Jasvinder <jasvinder.singh@intel.com>
> Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated
> 
> The destination string may not have a NULL termination if the source's string is
> equal to the sizeof(tmgr_port->name).
> 
> Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees NULL
> termination.
> 
> Coverity issue: 272592
> Fixes: 25961ff3bcb9 ("examples/ip_pipeline: add traffic manager object")
> Cc: jasvinder.singh@intel.com
> 
> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
> ---
>  examples/ip_pipeline/tmgr.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index
> b46ca96..40cbf1d 100644
> --- a/examples/ip_pipeline/tmgr.c
> +++ b/examples/ip_pipeline/tmgr.c
> @@ -4,6 +4,8 @@
> 
>  #include <stdlib.h>
> 
> +#include <rte_string_fns.h>
> +
>  #include "tmgr.h"
> 
>  static struct rte_sched_subport_params
> @@ -148,7 +150,7 @@ tmgr_port_create(const char *name, struct
> tmgr_port_params *params)
>  	}
> 
>  	/* Node fill in */
> -	strncpy(tmgr_port->name, name, sizeof(tmgr_port->name));
> +	strlcpy(tmgr_port->name, name, sizeof(tmgr_port->name));
>  	tmgr_port->s = s;
>  	tmgr_port->n_subports_per_port = params->n_subports_per_port;
>  	tmgr_port->n_pipes_per_subport = params->n_pipes_per_subport;
> --
> 2.9.5

Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-19 11:03 Kevin Laatz
  2018-04-19 15:33 ` Singh, Jasvinder
  0 siblings, 1 reply; 25+ messages in thread
From: Kevin Laatz @ 2018-04-19 11:03 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu, Kevin Laatz, jasvinder.singh

The destination string may not have a NULL termination if the source's
string is equal to the sizeof(tmgr_port->name).

Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees
NULL termination.

Coverity issue: 272592
Fixes: 25961ff3bcb9 ("examples/ip_pipeline: add traffic manager object")
Cc: jasvinder.singh@intel.com

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 examples/ip_pipeline/tmgr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c
index b46ca96..40cbf1d 100644
--- a/examples/ip_pipeline/tmgr.c
+++ b/examples/ip_pipeline/tmgr.c
@@ -4,6 +4,8 @@
 
 #include <stdlib.h>
 
+#include <rte_string_fns.h>
+
 #include "tmgr.h"
 
 static struct rte_sched_subport_params
@@ -148,7 +150,7 @@ tmgr_port_create(const char *name, struct tmgr_port_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(tmgr_port->name, name, sizeof(tmgr_port->name));
+	strlcpy(tmgr_port->name, name, sizeof(tmgr_port->name));
 	tmgr_port->s = s;
 	tmgr_port->n_subports_per_port = params->n_subports_per_port;
 	tmgr_port->n_pipes_per_subport = params->n_pipes_per_subport;
-- 
2.9.5

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-19 11:01 Kevin Laatz
  2018-04-19 15:34 ` Singh, Jasvinder
  0 siblings, 1 reply; 25+ messages in thread
From: Kevin Laatz @ 2018-04-19 11:01 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu, Kevin Laatz, jasvinder.singh

The destination string may not have a NULL termination if the source's
string is equal to the sizeof(mempool->name).

Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees
NULL termination.

Coverity issue: 272588
Fixes: 6bfe74f8c93e ("examples/ip_pipeline: add mempool object")
Cc: jasvinder.singh@intel.com

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
---
 examples/ip_pipeline/mempool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/mempool.c b/examples/ip_pipeline/mempool.c
index 33b9243..f5d2a7d 100644
--- a/examples/ip_pipeline/mempool.c
+++ b/examples/ip_pipeline/mempool.c
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include <rte_mbuf.h>
+#include <rte_string_fns.h>
 
 #include "mempool.h"
 
@@ -70,7 +71,7 @@ mempool_create(const char *name, struct mempool_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(mempool->name, name, sizeof(mempool->name));
+	strlcpy(mempool->name, name, sizeof(mempool->name));
 	mempool->m = m;
 	mempool->buffer_size = params->buffer_size;
 
-- 
2.9.5

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17 15:01 ` Bruce Richardson
@ 2018-04-17 16:33   ` Singh, Jasvinder
  0 siblings, 0 replies; 25+ messages in thread
From: Singh, Jasvinder @ 2018-04-17 16:33 UTC (permalink / raw)
  To: Richardson, Bruce; +Cc: dev, Dumitrescu, Cristian

> -----Original Message-----
> From: Richardson, Bruce
> Sent: Tuesday, April 17, 2018 4:01 PM
> To: Singh, Jasvinder <jasvinder.singh@intel.com>
> Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null
> terminated
> 
> On Tue, Apr 17, 2018 at 02:28:25PM +0100, Jasvinder Singh wrote:
> > The destination string may not have a null termination if the source
> > string's length is equal to the sizeof(pipeline->name).
> >
> > Fix by replacing strncpy with strlcpy that guarantees NULL-termination.
> >
> > Coverty issue: 272606
> > Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object")
> >
> > Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> 
> Does this need an include of rte_string_fns.h?
> 
> In terms of the change itself:
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 

It got reference of rte_string_fns.h through other header files there. So build was ok, but I will send v2 with explicit include. Thanks.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17 13:28 Jasvinder Singh
@ 2018-04-17 15:01 ` Bruce Richardson
  2018-04-17 16:33   ` Singh, Jasvinder
  0 siblings, 1 reply; 25+ messages in thread
From: Bruce Richardson @ 2018-04-17 15:01 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev, cristian.dumitrescu

On Tue, Apr 17, 2018 at 02:28:25PM +0100, Jasvinder Singh wrote:
> The destination string may not have a null termination if
> the source string's length is equal to the sizeof(pipeline->name).
> 
> Fix by replacing strncpy with strlcpy that guarantees NULL-termination.
> 
> Coverty issue: 272606
> Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object")
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>

Does this need an include of rte_string_fns.h?

In terms of the change itself:

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  examples/ip_pipeline/pipeline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c
> index 76aa1d3..132f1a8 100644
> --- a/examples/ip_pipeline/pipeline.c
> +++ b/examples/ip_pipeline/pipeline.c
> @@ -129,7 +129,7 @@ pipeline_create(const char *name, struct pipeline_params *params)
>  	}
>  
>  	/* Node fill in */
> -	strncpy(pipeline->name, name, sizeof(pipeline->name));
> +	strlcpy(pipeline->name, name, sizeof(pipeline->name));
>  	pipeline->p = p;
>  	pipeline->n_ports_in = 0;
>  	pipeline->n_ports_out = 0;
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17 13:17 Jasvinder Singh
@ 2018-04-17 14:59 ` Bruce Richardson
  0 siblings, 0 replies; 25+ messages in thread
From: Bruce Richardson @ 2018-04-17 14:59 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev, cristian.dumitrescu

On Tue, Apr 17, 2018 at 02:17:19PM +0100, Jasvinder Singh wrote:
> The destination string may not have a null termination if
> the source string's length is equal to the sizeof(tap->name).
> 
> Fix by replacing strncpy with strlcpy that guarantees NULL-termination.
> 
> Coverty issue: 272603
> Fixes: 2f74ae28e23f ("examples/ip_pipeline: add tap object")
> 
> Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-17 13:28 Jasvinder Singh
  2018-04-17 15:01 ` Bruce Richardson
  0 siblings, 1 reply; 25+ messages in thread
From: Jasvinder Singh @ 2018-04-17 13:28 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu

The destination string may not have a null termination if
the source string's length is equal to the sizeof(pipeline->name).

Fix by replacing strncpy with strlcpy that guarantees NULL-termination.

Coverty issue: 272606
Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 examples/ip_pipeline/pipeline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c
index 76aa1d3..132f1a8 100644
--- a/examples/ip_pipeline/pipeline.c
+++ b/examples/ip_pipeline/pipeline.c
@@ -129,7 +129,7 @@ pipeline_create(const char *name, struct pipeline_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(pipeline->name, name, sizeof(pipeline->name));
+	strlcpy(pipeline->name, name, sizeof(pipeline->name));
 	pipeline->p = p;
 	pipeline->n_ports_in = 0;
 	pipeline->n_ports_out = 0;
-- 
2.9.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-17 13:17 Jasvinder Singh
  2018-04-17 14:59 ` Bruce Richardson
  0 siblings, 1 reply; 25+ messages in thread
From: Jasvinder Singh @ 2018-04-17 13:17 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu

The destination string may not have a null termination if
the source string's length is equal to the sizeof(tap->name).

Fix by replacing strncpy with strlcpy that guarantees NULL-termination.

Coverty issue: 272603
Fixes: 2f74ae28e23f ("examples/ip_pipeline: add tap object")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 examples/ip_pipeline/tap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/tap.c b/examples/ip_pipeline/tap.c
index 5b34032..a4e10fa 100644
--- a/examples/ip_pipeline/tap.c
+++ b/examples/ip_pipeline/tap.c
@@ -15,6 +15,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <rte_string_fns.h>
+
 #include "tap.h"
 
 #define TAP_DEV                                            "/dev/net/tun"
@@ -85,7 +87,7 @@ tap_create(const char *name)
 		return NULL;
 
 	/* Node fill in */
-	strncpy(tap->name, name, sizeof(tap->name));
+	strlcpy(tap->name, name, sizeof(tap->name));
 	tap->fd = fd;
 
 	/* Node add to list */
-- 
2.9.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-16 16:57 Jasvinder Singh
  0 siblings, 0 replies; 25+ messages in thread
From: Jasvinder Singh @ 2018-04-16 16:57 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu

The destination string may not have a null termination if
the source string's length is equal to the sizeof(link->name).

Fix by replacing strncpy with strlcpy that guarantees NULL-termination.

Coverty issue: 272594
Fixes: 133c2c6565d6 ("examples/ip_pipeline: add link object")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 examples/ip_pipeline/link.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 26ff41b..b8a431f 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -6,6 +6,7 @@
 #include <string.h>
 
 #include <rte_ethdev.h>
+#include <rte_string_fns.h>
 
 #include "link.h"
 #include "mempool.h"
@@ -236,7 +237,7 @@ link_create(const char *name, struct link_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(link->name, name, sizeof(link->name));
+	strlcpy(link->name, name, sizeof(link->name));
 	link->port_id = port_id;
 	link->n_rxq = params->rx.n_queues;
 	link->n_txq = params->tx.n_queues;
-- 
2.9.3

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
  2018-04-16 11:02 Fan Zhang
@ 2018-04-16 13:17 ` Bruce Richardson
  2018-05-08 14:28 ` Dumitrescu, Cristian
  1 sibling, 0 replies; 25+ messages in thread
From: Bruce Richardson @ 2018-04-16 13:17 UTC (permalink / raw)
  To: Fan Zhang; +Cc: dev, cristian.dumitrescu, jasvinder.singh

On Mon, Apr 16, 2018 at 12:02:33PM +0100, Fan Zhang wrote:
> Coverity issue: 272572
> Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  examples/ip_pipeline/action.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
> index 77a04fe19..91011ebe8 100644
> --- a/examples/ip_pipeline/action.c
> +++ b/examples/ip_pipeline/action.c
> @@ -133,7 +133,7 @@ port_in_action_profile_create(const char *name,
>  	}
>  
>  	/* Node fill in */
> -	strncpy(profile->name, name, sizeof(profile->name));
> +	strncpy(profile->name, name, sizeof(profile->name) - 1);
>  	memcpy(&profile->params, params, sizeof(*params));
>  	profile->ap = ap;

No, this still doesn't null terminate, and is a perfect example of why we
should never use strncpy! Use strlcpy instead.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated
@ 2018-04-16 11:02 Fan Zhang
  2018-04-16 13:17 ` Bruce Richardson
  2018-05-08 14:28 ` Dumitrescu, Cristian
  0 siblings, 2 replies; 25+ messages in thread
From: Fan Zhang @ 2018-04-16 11:02 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu, jasvinder.singh

Coverity issue: 272572
Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/ip_pipeline/action.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.c
index 77a04fe19..91011ebe8 100644
--- a/examples/ip_pipeline/action.c
+++ b/examples/ip_pipeline/action.c
@@ -133,7 +133,7 @@ port_in_action_profile_create(const char *name,
 	}
 
 	/* Node fill in */
-	strncpy(profile->name, name, sizeof(profile->name));
+	strncpy(profile->name, name, sizeof(profile->name) - 1);
 	memcpy(&profile->params, params, sizeof(*params));
 	profile->ap = ap;
 
-- 
2.13.6

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated.
@ 2018-04-16 10:26 Fan Zhang
  2018-05-08 14:27 ` Dumitrescu, Cristian
  0 siblings, 1 reply; 25+ messages in thread
From: Fan Zhang @ 2018-04-16 10:26 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu, jasvinder.singh

Coverity issue: 272563
Fixes: 8245472c58c8 ("examples/ip_pipeline: add sw queue object")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/ip_pipeline/swq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/swq.c b/examples/ip_pipeline/swq.c
index c11bbf27e..be78704c1 100644
--- a/examples/ip_pipeline/swq.c
+++ b/examples/ip_pipeline/swq.c
@@ -64,7 +64,7 @@ swq_create(const char *name, struct swq_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(swq->name, name, sizeof(swq->name));
+	strncpy(swq->name, name, sizeof(swq->name) - 1);
 	swq->r = r;
 
 	/* Node add to list */
-- 
2.13.6

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-05-09  9:26 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 16:58 [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Reshma Pattan
2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
2018-04-19  8:36   ` Singh, Jasvinder
2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipipeline: fix resource leak Reshma Pattan
2018-04-19  8:37   ` Singh, Jasvinder
2018-04-18 16:58 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Reshma Pattan
2018-04-19  8:35   ` Singh, Jasvinder
2018-04-19  8:37 ` [dpdk-dev] [PATCH] examples/ip_pipeline: fixes uninitialized scalar variable Singh, Jasvinder
  -- strict thread matches above, loose matches on Subject: below --
2018-04-19 11:03 [dpdk-dev] [PATCH] examples/ip_pipeline: fix buffer not null terminated Kevin Laatz
2018-04-19 15:33 ` Singh, Jasvinder
2018-04-19 11:01 Kevin Laatz
2018-04-19 15:34 ` Singh, Jasvinder
2018-04-17 13:28 Jasvinder Singh
2018-04-17 15:01 ` Bruce Richardson
2018-04-17 16:33   ` Singh, Jasvinder
2018-04-17 13:17 Jasvinder Singh
2018-04-17 14:59 ` Bruce Richardson
2018-04-16 16:57 Jasvinder Singh
2018-04-16 11:02 Fan Zhang
2018-04-16 13:17 ` Bruce Richardson
2018-05-08 14:28 ` Dumitrescu, Cristian
2018-05-08 19:51   ` Bruce Richardson
2018-05-09  9:26     ` Dumitrescu, Cristian
2018-04-16 10:26 Fan Zhang
2018-05-08 14:27 ` Dumitrescu, Cristian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).