Since the tests construct a mulit-part path in huge pages directory, avoid overflowing the string buffer by limiting the possible huge page directory. Can never happen in real life, but compiler gives warnings about string overflow that it could.
Signed-off-by: Stephen Hemminger <[email protected]> --- app/test/test_eal_flags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index c2e6c00edb..e21029255e 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -172,7 +172,7 @@ process_hugefiles(const char * prefix, enum hugepage_action action) struct dirent *dirent = NULL; char hugefile_prefix[PATH_MAX] = {0}; - char hugedir[PATH_MAX] = {0}; + char hugedir[PATH_MAX - NAME_MAX] = {0}; char line[PATH_MAX] = {0}; int fd, lck_result, result = 0; @@ -873,7 +873,7 @@ test_no_huge_flag(void) static int test_misc_flags(void) { - char hugepath[PATH_MAX] = {0}; + char hugepath[PATH_MAX - NAME_MAX] = {0}; char hugepath_dir[PATH_MAX] = {0}; char hugepath_dir2[PATH_MAX] = {0}; char hugepath_dir3[PATH_MAX] = {0}; -- 2.51.0

