From: GNU Libc Maintainers Date: Sat, 1 Jun 2024 21:16:35 +0000 (+0200) Subject: git-glob_dirent X-Git-Tag: archive/raspbian/2.38-12+rpi1^2~78 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9e42177e8b17c3329e555f1c57f24f04de31d03c;p=glibc.git git-glob_dirent commit 5e4435f960bb681cbea853fb41043fabeeaea1b4 Author: Samuel Thibault Date: Thu Aug 3 21:15:39 2023 +0200 tst-*glob*: Do not check d_name size Posix says that d_name is of unspecified size, and sizeof(d_name) should not be used. It is indeed only 1-byte long in bits/dirent.h. We can instead explictly provide the actual allocated size to __strcpy_chk. Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name git-glob_dirent.diff --- diff --git a/posix/tst-glob_lstat_compat.c b/posix/tst-glob_lstat_compat.c index 937ad77da..655995424 100644 --- a/posix/tst-glob_lstat_compat.c +++ b/posix/tst-glob_lstat_compat.c @@ -173,7 +173,7 @@ my_readdir (void *gdir) dir->d.d_type = filesystem[dir->idx].type; - strcpy (dir->d.d_name, filesystem[dir->idx].name); + __strcpy_chk (dir->d.d_name, filesystem[dir->idx].name, NAME_MAX); ++dir->idx; diff --git a/posix/tst-gnuglob-skeleton.c b/posix/tst-gnuglob-skeleton.c index 557cfcbd2..998fc2d94 100644 --- a/posix/tst-gnuglob-skeleton.c +++ b/posix/tst-gnuglob-skeleton.c @@ -222,7 +222,7 @@ my_readdir (void *gdir) dir->d.d_type = filesystem[dir->idx].type; - strcpy (dir->d.d_name, filesystem[dir->idx].name); + __strcpy_chk (dir->d.d_name, filesystem[dir->idx].name, NAME_MAX); if (test_verbose > 0) printf ("info: my_readdir ({ level: %d, idx: %ld })"