multipath tests: hwtable: fix strncat() invocation
authorMartin Wilck <mwilck@suse.com>
Sat, 12 Oct 2019 21:28:54 +0000 (21:28 +0000)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Mon, 2 Mar 2020 08:19:49 +0000 (09:19 +0100)
clang detected this error.

Signed-off-by: Martin Wilck <mwilck@suse.com>
tests/hwtable.c

index 977a566..473028b 100644 (file)
@@ -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);