diff --git a/lib/libc/tests/string/wcsnlen_test.c b/lib/libc/tests/string/wcsnlen_test.c index ec11938b19a9..07870e3a5ca0 100644 --- a/lib/libc/tests/string/wcsnlen_test.c +++ b/lib/libc/tests/string/wcsnlen_test.c @@ -65,7 +65,7 @@ test_wcsnlen(const wchar_t *s) for (i = 0; i <= 1; i++) { for (bufsize = 0; bufsize <= size + 10; bufsize++) { s1 = makebuf(bufsize * sizeof(wchar_t), i); - wmemcpy(s1, s, bufsize); + wmemcpy(s1, s, bufsize <= size ? bufsize : size); len = (size > bufsize) ? bufsize : size - 1; ATF_CHECK(wcsnlen(s1, bufsize) == len); }