about summary refs log tree commit diff
path: root/posix/tst-glob_lstat_compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'posix/tst-glob_lstat_compat.c')
-rw-r--r--posix/tst-glob_lstat_compat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/posix/tst-glob_lstat_compat.c b/posix/tst-glob_lstat_compat.c
index 6ea3b062f0..70d5c54838 100644
--- a/posix/tst-glob_lstat_compat.c
+++ b/posix/tst-glob_lstat_compat.c
@@ -173,7 +173,13 @@ my_readdir (void *gdir)
 
   dir->d.d_type = filesystem[dir->idx].type;
 
-  __strcpy_chk (dir->d.d_name, filesystem[dir->idx].name, NAME_MAX);
+  {
+    size_t len = strlen (filesystem[dir->idx].name);
+    if (len >= NAME_MAX)
+      FAIL_EXIT1 ("[%s] entry name larger than NAME_MAX (%d)", __func__,
+		  NAME_MAX);
+    memcpy (dir->d.d_name, filesystem[dir->idx].name, len + 1);
+  }
 
   ++dir->idx;