From: Amr Mokhtar Date: Wed, 31 Jan 2018 12:40:40 +0000 (+0000) Subject: app/bbdev: fix null termination in argument parsing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9efeea0a19fa3da77b72905d85d5c24a2320080b;p=dpdk.git app/bbdev: fix null termination in argument parsing use snprintf instead of strncpy to ensure null termination when copying test_vector_filename from cmd arguments. Coverity issue: 257001 Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") Signed-off-by: Amr Mokhtar --- diff --git a/app/test-bbdev/main.c b/app/test-bbdev/main.c index 3f542a85a5..41b54bb11b 100644 --- a/app/test-bbdev/main.c +++ b/app/test-bbdev/main.c @@ -226,8 +226,9 @@ parse_args(int argc, char **argv, struct test_params *tp) TEST_ASSERT(strlen(optarg) > 0, "Config file name is null"); - strncpy(tp->test_vector_filename, optarg, - sizeof(tp->test_vector_filename)); + snprintf(tp->test_vector_filename, + sizeof(tp->test_vector_filename), + "%s", optarg); break; case 'l': TEST_ASSERT(strlen(optarg) > 0,