From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: pablo.de.lara.guarch@intel.com, thomas@monjalon.net,
Jerin Jacob <jerin.jacob@caviumnetworks.com>,
declan.doherty@intel.com, andy@warmcat.com, stable@dpdk.org
Subject: [dpdk-stable] [dpdk-dev] [PATCH v2 1/2] app/crypto-perf: use strcpy for allocated string
Date: Wed, 16 May 2018 17:58:03 +0530 [thread overview]
Message-ID: <20180516122804.535-1-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <20180516063955.6193-1-jerin.jacob@caviumnetworks.com>
inlined from ‘cperf_test_vector_get_from_file’ at
../app/test-crypto-perf/cperf_test_vector_parsing.c:578:11:
../app/test-crypto-perf/cperf_test_vector_parsing.c:510:3: error:
‘strncpy’ output truncated before terminating nul copying as many bytes
from a string as its length [-Werror=stringop-truncation]
strncpy(entry, line, strlen(line));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/test-crypto-perf/cperf_test_vector_parsing.c:528:5: error:
‘strncat’ output truncated before terminating nul copying as many bytes
from a string as its length [-Werror=stringop-truncation]
strncat(entry, line, strlen(line));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found this issue with meson build and gcc 8.1.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: declan.doherty@intel.com
Cc: andy@warmcat.com
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
v2:
- No change
---
app/test-crypto-perf/cperf_test_vector_parsing.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 26321d004..92932a230 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -506,8 +506,7 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
if (entry == NULL)
return -1;
- memset(entry, 0, strlen(line) + 1);
- strncpy(entry, line, strlen(line));
+ strcpy(entry, line);
/* check if entry ends with , or = */
if (entry[strlen(entry) - 1] == ','
@@ -524,8 +523,8 @@ parse_file(struct cperf_test_vector *vector, struct cperf_options *opts)
if (entry_extended == NULL)
goto err;
entry = entry_extended;
-
- strncat(entry, line, strlen(line));
+ /* entry has been allocated accordingly */
+ strcpy(&entry[strlen(entry)], line);
if (entry[strlen(entry) - 1] != ',')
break;
--
2.17.0
next prev parent reply other threads:[~2018-05-16 12:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 6:39 [dpdk-stable] [dpdk-dev] [PATCH " Jerin Jacob
2018-05-16 6:39 ` [dpdk-stable] [dpdk-dev] [PATCH 2/2] app/crypto-perf: fix memcpy source range Jerin Jacob
2018-05-16 11:40 ` De Lara Guarch, Pablo
2018-05-16 11:59 ` Jerin Jacob
2018-05-16 9:50 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/crypto-perf: use strcpy for allocated string De Lara Guarch, Pablo
2018-05-16 12:28 ` Jerin Jacob [this message]
2018-05-16 12:28 ` [dpdk-stable] [dpdk-dev] [PATCH v2 2/2] app/crypto-perf: fix memcpy source Jerin Jacob
2018-05-16 12:44 ` Andy Green
2018-05-16 12:50 ` De Lara Guarch, Pablo
2018-05-17 16:31 ` De Lara Guarch, Pablo
2018-05-17 16:31 ` [dpdk-stable] [dpdk-dev] [PATCH v2 1/2] app/crypto-perf: use strcpy for allocated string De Lara Guarch, Pablo
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=20180516122804.535-1-jerin.jacob@caviumnetworks.com \
--to=jerin.jacob@caviumnetworks.com \
--cc=andy@warmcat.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/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).