DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, jananeex.m.parthasarathy@intel.com,
	pablo.de.lara.guarch@intel.com, declan.doherty@intel.com,
	Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] app/test: fix possible overflow with strcat
Date: Thu, 14 Mar 2019 13:14:40 +0000	[thread overview]
Message-ID: <1552569280-27944-1-git-send-email-tallurix.chaitanya.babu@intel.com> (raw)

strcat does not check the destination length and there might be
chances of string overflow so instead of strcat, strlcat is used.

Fixes: 6f4eec2565 ("test/crypto: enhance scheduler unit tests")
Cc: stable@dpdk.org

Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>
---
 app/test/test_cryptodev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 32f1893bc..2ff204137 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -15,6 +15,7 @@
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
+#include <rte_string_fns.h>
 
 #ifdef RTE_LIBRTE_PMD_CRYPTO_SCHEDULER
 #include <rte_cryptodev_scheduler.h>
@@ -375,7 +376,7 @@ testsuite_setup(void)
 			snprintf(vdev_args, sizeof(vdev_args),
 					"%s%d", temp_str, i);
 			strcpy(temp_str, vdev_args);
-			strcat(temp_str, ";");
+			strlcat(temp_str, ";", sizeof(temp_str));
 			slave_core_count++;
 			socket_id = lcore_config[i].socket_id;
 		}
-- 
2.17.2

             reply	other threads:[~2019-03-14 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 13:14 Chaitanya Babu Talluri [this message]
2019-03-14 13:14 ` Chaitanya Babu Talluri
2019-03-18 12:36 ` [dpdk-dev] [PATCH v2] app/test: fix possible overflow using strlcat Chaitanya Babu Talluri
2019-03-18 12:36   ` Chaitanya Babu Talluri
2019-03-22 14:31   ` Akhil Goyal
2019-03-22 14:31     ` Akhil Goyal
2019-03-22 15:07     ` Akhil Goyal
2019-03-22 15:07       ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1552569280-27944-1-git-send-email-tallurix.chaitanya.babu@intel.com \
    --to=tallurix.chaitanya.babu@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=jananeex.m.parthasarathy@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).