Both these tests lookup the current file prefix and
format up a filename argument. Avoid any possible format
overflows by allowing for bigger string.

Signed-off-by: Stephen Hemminger <[email protected]>
---
 app/test/test_mp_secondary.c | 4 ++--
 app/test/test_pdump.c        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c
index f3694530a8..1b1d8b38f7 100644
--- a/app/test/test_mp_secondary.c
+++ b/app/test/test_mp_secondary.c
@@ -69,8 +69,8 @@ run_secondary_instances(void)
        char coremask[10];
 
 #ifdef RTE_EXEC_ENV_LINUX
-       char tmp[PATH_MAX] = {0};
-       char prefix[PATH_MAX] = {0};
+       char tmp[PATH_MAX];
+       char prefix[PATH_MAX + sizeof("--file-prefix=")];
 
        get_current_prefix(tmp, sizeof(tmp));
 
diff --git a/app/test/test_pdump.c b/app/test/test_pdump.c
index 9f7769707e..c809dd2aca 100644
--- a/app/test/test_pdump.c
+++ b/app/test/test_pdump.c
@@ -176,8 +176,8 @@ run_pdump_server_tests(void)
        char coremask[10];
 
 #ifdef RTE_EXEC_ENV_LINUX
-       char tmp[PATH_MAX] = { 0 };
-       char prefix[PATH_MAX] = { 0 };
+       char tmp[PATH_MAX];
+       char prefix[PATH_MAX + sizeof("--file-prefix")];
 
        get_current_prefix(tmp, sizeof(tmp));
        snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
-- 
2.51.0

Reply via email to