DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pallantla Poornima <pallantlax.poornima@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, maxime.coquelin@redhat.com,
	tiwei.bie@intel.com,  zhihong.wang@intel.com,
	Pallantla Poornima <pallantlax.poornima@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH] vhost: fix sprintf with snprintf
Date: Mon,  4 Feb 2019 07:28:06 +0000	[thread overview]
Message-ID: <1549265286-6217-1-git-send-email-pallantlax.poornima@intel.com> (raw)
In-Reply-To: <y>

sprintf function is not secure as it doesn't check the length of string.
More secure function snprintf is used.

Fixes: d7280c9fff ("vhost: support selective datapath")
Cc: stable@dpdk.org

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
---
 lib/librte_vhost/vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c
index 02083bb8a..fcc2c73a3 100644
--- a/lib/librte_vhost/vdpa.c
+++ b/lib/librte_vhost/vdpa.c
@@ -66,7 +66,7 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,
 	if (i == MAX_VHOST_DEVICE)
 		return -1;
 
-	sprintf(device_name, "vdpa-dev-%d", i);
+	snprintf(device_name, sizeof(device_name), "vdpa-dev-%d", i);
 	dev = rte_zmalloc(device_name, sizeof(struct rte_vdpa_device),
 			RTE_CACHE_LINE_SIZE);
 	if (!dev)
-- 
2.17.2

             reply	other threads:[~2019-02-04  7:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04  7:28 Pallantla Poornima [this message]
2019-02-04  9:32 ` Maxime Coquelin
     [not found]   ` <7AE31235A30B41498D1C31348DC858BD5B534A5F@IRSMSX103.ger.corp.intel.com>
2019-02-20  2:20     ` Tiwei Bie
2019-02-21 18:16 ` Maxime Coquelin

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=1549265286-6217-1-git-send-email-pallantlax.poornima@intel.com \
    --to=pallantlax.poornima@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@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).