[dm-devel] [PATCH 62/72] multipath tests: hwtable: fix strncat() invocation

Martin Wilck Martin.Wilck at suse.com
Sat Oct 12 21:28:54 UTC 2019


From: Martin Wilck <mwilck at suse.com>

clang detected this error.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 tests/hwtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/hwtable.c b/tests/hwtable.c
index 977a5663..473028b7 100644
--- a/tests/hwtable.c
+++ b/tests/hwtable.c
@@ -261,7 +261,7 @@ static void write_defaults(const struct hwt_state *hwt)
 	defaults[0].value = hwt->dirname;
 	defaults[1].value = buf;
 	assert_ptr_not_equal(getcwd(dirbuf, sizeof(dirbuf)), NULL);
-	strncat(dirbuf, "/lib", sizeof(dirbuf));
+	strncat(dirbuf, "/lib", sizeof(dirbuf) - 5);
 	defaults[2].value = dirbuf;
 	write_section(hwt->config_file, "defaults",
 		      ARRAY_SIZE(defaults), defaults);
-- 
2.23.0





More information about the dm-devel mailing list