From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>,
cristian.dumitrescu@intel.com, jasvinder.singh@intel.com
Subject: [dpdk-dev] [PATCH 4/4] net/softnic: fix string copy
Date: Tue, 30 Oct 2018 14:22:52 +0000 [thread overview]
Message-ID: <1540909372-23110-4-git-send-email-reshma.pattan@intel.com> (raw)
In-Reply-To: <1540909372-23110-1-git-send-email-reshma.pattan@intel.com>
From: Reshma Pattan <reshma.pattan@intel.com>
Use strlcpy instead of strcpy to avoid buffer overrun.
Coverity issue: 323478
Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays")
CC: cristian.dumitrescu@intel.com
CC: jasvinder.singh@intel.com
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
drivers/net/softnic/rte_eth_softnic_cli.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index a0beca904..57b623377 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1867,7 +1867,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,
p.type = PORT_IN_RXQ;
- strcpy(p.dev_name, tokens[t0 + 1]);
+ strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));
if (strcmp(tokens[t0 + 2], "rxq") != 0) {
snprintf(out, out_size, MSG_ARG_NOT_FOUND, "rxq");
@@ -1890,7 +1890,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,
p.type = PORT_IN_SWQ;
- strcpy(p.dev_name, tokens[t0 + 1]);
+ strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));
t0 += 2;
} else if (strcmp(tokens[t0], "tmgr") == 0) {
@@ -1902,7 +1902,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,
p.type = PORT_IN_TMGR;
- strcpy(p.dev_name, tokens[t0 + 1]);
+ strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));
t0 += 2;
} else if (strcmp(tokens[t0], "tap") == 0) {
@@ -1914,7 +1914,7 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,
p.type = PORT_IN_TAP;
- strcpy(p.dev_name, tokens[t0 + 1]);
+ strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name));
if (strcmp(tokens[t0 + 2], "mempool") != 0) {
snprintf(out, out_size, MSG_ARG_NOT_FOUND,
@@ -2009,7 +2009,8 @@ cmd_pipeline_port_in(struct pmd_internals *softnic,
return;
}
- strcpy(p.action_profile_name, tokens[t0 + 1]);
+ strlcpy(p.action_profile_name, tokens[t0 + 1],
+ sizeof(p.action_profile_name));
t0 += 2;
}
--
2.17.1
next prev parent reply other threads:[~2018-10-30 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-30 14:22 [dpdk-dev] [PATCH 1/4] " Reshma Pattan
2018-10-30 14:22 ` [dpdk-dev] [PATCH 2/4] " Reshma Pattan
2018-10-30 14:22 ` [dpdk-dev] [PATCH 3/4] " Reshma Pattan
2018-10-30 14:22 ` Reshma Pattan [this message]
2018-10-31 9:47 ` [dpdk-dev] [PATCH 1/4] " Thomas Monjalon
2018-10-31 10:16 ` [dpdk-dev] [PATCH v2] " Reshma Pattan
2018-11-02 11:47 ` Dumitrescu, Cristian
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=1540909372-23110-4-git-send-email-reshma.pattan@intel.com \
--to=reshma.pattan@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=jasvinder.singh@intel.com \
/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).