DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated.
@ 2018-04-17  9:45 Fan Zhang
  2018-04-17 11:23 ` Bruce Richardson
  2018-05-08 14:29 ` Dumitrescu, Cristian
  0 siblings, 2 replies; 7+ messages in thread
From: Fan Zhang @ 2018-04-17  9:45 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>
---
v2:
- using more generic strlcpy approach 

 examples/ip_pipeline/swq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/swq.c b/examples/ip_pipeline/swq.c
index c11bbf27e..7e54a1dbf 100644
--- a/examples/ip_pipeline/swq.c
+++ b/examples/ip_pipeline/swq.c
@@ -5,6 +5,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <rte_string_fns.h>
+
 #include "swq.h"
 
 static struct swq_list swq_list;
@@ -64,7 +66,7 @@ swq_create(const char *name, struct swq_params *params)
 	}
 
 	/* Node fill in */
-	strncpy(swq->name, name, sizeof(swq->name));
+	strlcpy(swq->name, name, sizeof(swq->name));
 	swq->r = r;
 
 	/* Node add to list */
-- 
2.13.6

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

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

On Tue, Apr 17, 2018 at 10:45:46AM +0100, Fan Zhang wrote:
> Coverity issue: 272563
> Fixes: 8245472c58c8 ("examples/ip_pipeline: add sw queue object")
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated.
  2018-04-17  9:45 [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated Fan Zhang
  2018-04-17 11:23 ` Bruce Richardson
@ 2018-05-08 14:29 ` Dumitrescu, Cristian
  1 sibling, 0 replies; 7+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-08 14:29 UTC (permalink / raw)
  To: Zhang, Roy Fan, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Zhang, Roy Fan
> Sent: Tuesday, April 17, 2018 10:46 AM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>
> Subject: [PATCH v2] 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>
> ---
> v2:
> - using more generic strlcpy approach
> 
>  examples/ip_pipeline/swq.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/swq.c b/examples/ip_pipeline/swq.c
> index c11bbf27e..7e54a1dbf 100644
> --- a/examples/ip_pipeline/swq.c
> +++ b/examples/ip_pipeline/swq.c
> @@ -5,6 +5,8 @@
>  #include <stdlib.h>
>  #include <string.h>
> 
> +#include <rte_string_fns.h>
> +
>  #include "swq.h"
> 
>  static struct swq_list swq_list;
> @@ -64,7 +66,7 @@ swq_create(const char *name, struct swq_params
> *params)
>  	}
> 
>  	/* Node fill in */
> -	strncpy(swq->name, name, sizeof(swq->name));
> +	strlcpy(swq->name, name, sizeof(swq->name));
>  	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] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17 16:39 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
@ 2018-05-08 14:29   ` Dumitrescu, Cristian
  0 siblings, 0 replies; 7+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-08 14:29 UTC (permalink / raw)
  To: Singh, Jasvinder, dev; +Cc: Richardson, Bruce



> -----Original Message-----
> From: Singh, Jasvinder
> Sent: Tuesday, April 17, 2018 5:40 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Subject: [PATCH v2] examples/ip_pipeline: fix buffer not null terminated
> 
> 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>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  examples/ip_pipeline/pipeline.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/ip_pipeline/pipeline.c
> b/examples/ip_pipeline/pipeline.c
> index 76aa1d3..43fe867 100644
> --- a/examples/ip_pipeline/pipeline.c
> +++ b/examples/ip_pipeline/pipeline.c
> @@ -9,6 +9,7 @@
>  #include <rte_ip.h>
>  #include <rte_tcp.h>
> 
> +#include <rte_string_fns.h>
>  #include <rte_port_ethdev.h>
>  #ifdef RTE_LIBRTE_KNI
>  #include <rte_port_kni.h>
> @@ -129,7 +130,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
Acked-by: Cristian.Dumitrescu <cristian.dumitrescu@intel.com>

Applied to next-pipeline tree, thanks!

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

* [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17 13:28 [dpdk-dev] [PATCH] " Jasvinder Singh
@ 2018-04-17 16:39 ` Jasvinder Singh
  2018-05-08 14:29   ` Dumitrescu, Cristian
  0 siblings, 1 reply; 7+ messages in thread
From: Jasvinder Singh @ 2018-04-17 16:39 UTC (permalink / raw)
  To: dev; +Cc: cristian.dumitrescu, bruce.richardson

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>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/ip_pipeline/pipeline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c
index 76aa1d3..43fe867 100644
--- a/examples/ip_pipeline/pipeline.c
+++ b/examples/ip_pipeline/pipeline.c
@@ -9,6 +9,7 @@
 #include <rte_ip.h>
 #include <rte_tcp.h>
 
+#include <rte_string_fns.h>
 #include <rte_port_ethdev.h>
 #ifdef RTE_LIBRTE_KNI
 #include <rte_port_kni.h>
@@ -129,7 +130,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] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated
  2018-04-17  9:52 ` [dpdk-dev] [PATCH v2] " Fan Zhang
@ 2018-04-17 11:18   ` Bruce Richardson
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2018-04-17 11:18 UTC (permalink / raw)
  To: Fan Zhang; +Cc: dev, cristian.dumitrescu, jasvinder.singh

On Tue, Apr 17, 2018 at 10:52:52AM +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>
> ---
> v2:
> - use more generic strlcpy approach
> 
>  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..1203bb892 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"
>  
> @@ -133,7 +135,7 @@ port_in_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;
>  
>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated
  2018-04-16 11:02 [dpdk-dev] [PATCH] " Fan Zhang
@ 2018-04-17  9:52 ` Fan Zhang
  2018-04-17 11:18   ` Bruce Richardson
  0 siblings, 1 reply; 7+ messages in thread
From: Fan Zhang @ 2018-04-17  9:52 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>
---
v2:
- use more generic strlcpy approach

 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..1203bb892 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"
 
@@ -133,7 +135,7 @@ port_in_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.13.6

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

end of thread, other threads:[~2018-05-08 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17  9:45 [dpdk-dev] [PATCH v2] examples/ip_pipeline: fix buffer not null terminated Fan Zhang
2018-04-17 11:23 ` Bruce Richardson
2018-05-08 14:29 ` Dumitrescu, Cristian
  -- strict thread matches above, loose matches on Subject: below --
2018-04-17 13:28 [dpdk-dev] [PATCH] " Jasvinder Singh
2018-04-17 16:39 ` [dpdk-dev] [PATCH v2] " Jasvinder Singh
2018-05-08 14:29   ` Dumitrescu, Cristian
2018-04-16 11:02 [dpdk-dev] [PATCH] " Fan Zhang
2018-04-17  9:52 ` [dpdk-dev] [PATCH v2] " Fan Zhang
2018-04-17 11:18   ` Bruce Richardson

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).