diff options
Diffstat (limited to 'string/test-strncpy.c')
-rw-r--r-- | string/test-strncpy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/string/test-strncpy.c b/string/test-strncpy.c index 11ff30eebf..7820b61158 100644 --- a/string/test-strncpy.c +++ b/string/test-strncpy.c @@ -47,8 +47,8 @@ simple_strncpy (char *dst, const char *src, size_t n) char * stupid_strncpy (char *dst, const char *src, size_t n) { - size_t ns = strlen (src); - size_t i, nc = n < ns ? n : ns; + size_t nc = strnlen (src, n); + size_t i; for (i = 0; i < nc; ++i) dst[i] = src[i]; |