patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] examples/fips: add path length validation
@ 2020-02-02 15:57 michaelsh
  0 siblings, 0 replies; only message in thread
From: michaelsh @ 2020-02-02 15:57 UTC (permalink / raw)
  To: akhil.goyal; +Cc: marko.kovacevic, lironh, michaelsh, stable

From: Michael Shamis <michaelsh@marvell.com>

Coverity CID 350345:
"copy into fixed size buffer: string overflow."
Now the length of string is validated before copy.
Cc: stable@dpdk.org

Signed-off-by: Michael Shamis <michaelsh@marvell.com>
---
 examples/fips_validation/fips_validation.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c
index 07ffa62e9..48a92ee6d 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -257,6 +257,11 @@ fips_test_init(const char *req_file_path, const char *rsp_file_path,
 
 	fips_test_clear();
 
+	if (strlen(req_file_path) > MAX_STRING_SIZE) {
+		RTE_LOG(ERR, USER1, "File name %s is too long\n",
+				req_file_path);
+		return -EINVAL;
+	}
 	strcpy(info.file_name, req_file_path);
 	info.algo = FIPS_TEST_ALGO_MAX;
 	if (parse_file_type(req_file_path) < 0) {
-- 
2.24.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-02 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-02 15:57 [dpdk-stable] [PATCH] examples/fips: add path length validation michaelsh

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).