From: FengWei feng.wei8@zte.com.cn
strncpy() is deprecated for NUL-terminated destination buffers. Use strscpy() instead and remove the manual NUL-termination.
Signed-off-by: FengWei feng.wei8@zte.com.cn --- tools/testing/selftests/bpf/test_verifier.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c index 447b68509d76..dfe64c6d4f87 100644 --- a/tools/testing/selftests/bpf/test_verifier.c +++ b/tools/testing/selftests/bpf/test_verifier.c @@ -1320,8 +1320,7 @@ static bool cmp_str_seq(const char *log, const char *exp) printf("FAIL\nTestcase bug\n"); return false; } - strncpy(needle, exp, len); - needle[len] = 0; + strscpy(needle, exp, len); q = strstr(log, needle); if (!q) { printf("FAIL\nUnexpected verifier log!\n"