DPDK patches and discussions
 help / color / mirror / Atom feed
From: John Miller <john.miller@atomicrules.com>
To: dev@dpdk.org
Cc: ed.czeck@atomicrules.com, shepard.siegel@atomicrules.com,
	John Miller <john.miller@atomicrules.com>
Subject: [dpdk-dev] [PATCH 1/4] net/ark: fix for buffer not null terminated
Date: Tue, 16 May 2017 12:14:15 -0400	[thread overview]
Message-ID: <1494951258-11232-1-git-send-email-john.miller@atomicrules.com> (raw)

Coverity issue: 144512
Coverity issue: 144513
Fixes: 9c7188a68d7b ("net/ark: provide API for hardware modules pktchkr and pktgen")

Signed-off-by: John Miller <john.miller@atomicrules.com>
---
 drivers/net/ark/ark_pktchkr.c | 2 +-
 drivers/net/ark/ark_pktgen.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ark/ark_pktchkr.c b/drivers/net/ark/ark_pktchkr.c
index 62b3673..c3040af 100644
--- a/drivers/net/ark/ark_pktchkr.c
+++ b/drivers/net/ark/ark_pktchkr.c
@@ -372,7 +372,7 @@ struct OPTIONS {
 			o->v.INT = atoll(val);
 			break;
 		case OTSTRING:
-			strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+			snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
 			break;
 		}
 		return 1;
diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index bdac054..8c7a8a2 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -354,7 +354,7 @@ struct OPTIONS {
 			o->v.INT = atoll(val);
 			break;
 		case OTSTRING:
-			strncpy(o->v.STR, val, ARK_MAX_STR_LEN);
+			snprintf(o->v.STR, ARK_MAX_STR_LEN, "%s", val);
 			break;
 		}
 		return 1;
-- 
1.9.1

             reply	other threads:[~2017-05-16 16:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 16:14 John Miller [this message]
2017-05-16 16:14 ` [dpdk-dev] [PATCH 2/4] net/ark: fix return code not checked John Miller
2017-05-16 16:14 ` [dpdk-dev] [PATCH 3/4] net/ark: fix null pointer dereference John Miller
2017-05-16 16:14 ` [dpdk-dev] [PATCH 4/4] net/ark: fix return value of null not checked John Miller
2017-05-16 16:37 ` [dpdk-dev] [PATCH 1/4] net/ark: fix for buffer not null terminated Ferruh Yigit

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=1494951258-11232-1-git-send-email-john.miller@atomicrules.com \
    --to=john.miller@atomicrules.com \
    --cc=dev@dpdk.org \
    --cc=ed.czeck@atomicrules.com \
    --cc=shepard.siegel@atomicrules.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).