[dpdk-stable] [PATCH] examples/fips: add path length validation

michaelsh at marvell.com michaelsh at marvell.com
Sun Feb 2 16:57:14 CET 2020


From: Michael Shamis <michaelsh at marvell.com>

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

Signed-off-by: Michael Shamis <michaelsh at 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



More information about the stable mailing list