From: Pallantla Poornima <pallantlax.poornima@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, yipeng1.wang@intel.com,
sameh.gobriel@intel.com, bruce.richardson@intel.com,
pablo.de.lara.guarch@intel.com, stephen@networkplumber.org,
Pallantla Poornima <pallantlax.poornima@intel.com>,
stable@dpdk.org
Subject: [dpdk-stable] [PATCH v2] hash: fix sprintf with snprintf
Date: Thu, 14 Feb 2019 12:57:42 +0000 [thread overview]
Message-ID: <1550149062-14300-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: 473d1bebce ("hash: allow to store data in hash table")
Cc: stable@dpdk.org
Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
---
v2: Addressed review comment to correct the format specifier of
hastest_key_lens.
---
test/test/test_hash_perf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c
index 525211180..5648fce02 100644
--- a/test/test/test_hash_perf.c
+++ b/test/test/test_hash_perf.c
@@ -85,9 +85,11 @@ create_table(unsigned int with_data, unsigned int table_index,
if (with_data)
/* Table will store 8-byte data */
- sprintf(name, "test_hash%d_data", hashtest_key_lens[table_index]);
+ snprintf(name, sizeof(name), "test_hash%u_data",
+ hashtest_key_lens[table_index]);
else
- sprintf(name, "test_hash%d", hashtest_key_lens[table_index]);
+ snprintf(name, sizeof(name), "test_hash%u",
+ hashtest_key_lens[table_index]);
if (with_locks)
--
2.17.2
next reply other threads:[~2019-02-14 12:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 12:57 Pallantla Poornima [this message]
[not found] ` <EE76425279735140910E0DBA3963DA361BBA864D@BGSMSX103.gar.corp.intel.com>
2019-03-25 18:05 ` Wang, Yipeng1
2019-03-26 10:27 ` [dpdk-stable] [PATCH v3] app/test/hash: " Pallantla Poornima
2019-04-04 23:59 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
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=1550149062-14300-1-git-send-email-pallantlax.poornima@intel.com \
--to=pallantlax.poornima@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
--cc=reshma.pattan@intel.com \
--cc=sameh.gobriel@intel.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=yipeng1.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).