DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null terminated
@ 2017-02-07  9:20 Aleksander Gajewski
  2017-02-09 22:41 ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Aleksander Gajewski @ 2017-02-07  9:20 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Aleksander Gajewski

Fix problem: the string buffer may not have a null terminator if
the source string's length is equal to the buffer size.

Coverity issue: 141069
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
application")

Signed-off-by: Aleksander Gajewski <aleksanderx.gajewski@intel.com>
---
 app/test-crypto-perf/cperf_options_parsing.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c
index 3b7342d..691e788 100644
--- a/app/test-crypto-perf/cperf_options_parsing.c
+++ b/app/test-crypto-perf/cperf_options_parsing.c
@@ -198,7 +198,8 @@ struct name_id_map {
 	if (strlen(arg) > (sizeof(opts->device_type) - 1))
 		return -1;
 
-	strncpy(opts->device_type, arg, sizeof(opts->device_type));
+	strncpy(opts->device_type, arg, sizeof(opts->device_type) - 1);
+	*(opts->device_type + sizeof(opts->device_type) - 1) = '\0';
 
 	return 0;
 }
-- 
1.9.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.

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

* Re: [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null terminated
  2017-02-07  9:20 [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null terminated Aleksander Gajewski
@ 2017-02-09 22:41 ` De Lara Guarch, Pablo
  2017-02-09 23:00   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-09 22:41 UTC (permalink / raw)
  To: Gajewski, AleksanderX, Doherty, Declan; +Cc: dev, Gajewski, AleksanderX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Aleksander
> Gajewski
> Sent: Tuesday, February 07, 2017 9:20 AM
> To: Doherty, Declan
> Cc: dev@dpdk.org; Gajewski, AleksanderX
> Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null
> terminated
> 
> Fix problem: the string buffer may not have a null terminator if
> the source string's length is equal to the buffer size.
> 
> Coverity issue: 141069
> Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> application")
> 
> Signed-off-by: Aleksander Gajewski <aleksanderx.gajewski@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

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

* Re: [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null terminated
  2017-02-09 22:41 ` De Lara Guarch, Pablo
@ 2017-02-09 23:00   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-02-09 23:00 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Gajewski, AleksanderX, Doherty, Declan
  Cc: dev, Gajewski, AleksanderX



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Thursday, February 09, 2017 10:42 PM
> To: Gajewski, AleksanderX; Doherty, Declan
> Cc: dev@dpdk.org; Gajewski, AleksanderX
> Subject: Re: [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null
> terminated
> 
> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Aleksander
> > Gajewski
> > Sent: Tuesday, February 07, 2017 9:20 AM
> > To: Doherty, Declan
> > Cc: dev@dpdk.org; Gajewski, AleksanderX
> > Subject: [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null
> > terminated
> >
> > Fix problem: the string buffer may not have a null terminator if
> > the source string's length is equal to the buffer size.
> >
> > Coverity issue: 141069
> > Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test
> > application")
> >
> > Signed-off-by: Aleksander Gajewski <aleksanderx.gajewski@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

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

end of thread, other threads:[~2017-02-09 23:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07  9:20 [dpdk-dev] [PATCH] app/test-crypto-perf: fix buffer not null terminated Aleksander Gajewski
2017-02-09 22:41 ` De Lara Guarch, Pablo
2017-02-09 23:00   ` De Lara Guarch, Pablo

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