summary refs log tree commit diff
path: root/string/test-stpncpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/test-stpncpy.c')
-rw-r--r--string/test-stpncpy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string/test-stpncpy.c b/string/test-stpncpy.c
index 5bcb1ddef4..8784588645 100644
--- a/string/test-stpncpy.c
+++ b/string/test-stpncpy.c
@@ -47,8 +47,8 @@ simple_stpncpy (char *dst, const char *src, size_t n)
 char *
 stupid_stpncpy (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];