git-glob_dirent
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Sat, 1 Jun 2024 21:16:35 +0000 (23:16 +0200)
committerAurelien Jarno <aurel32@debian.org>
Sat, 1 Jun 2024 21:16:35 +0000 (23:16 +0200)
commit 5e4435f960bb681cbea853fb41043fabeeaea1b4
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
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

posix/tst-glob_lstat_compat.c
posix/tst-gnuglob-skeleton.c

index 937ad77da3d5642cbb0b3e93a4577107b85f10c4..6559954247c3be8a856fcd6977acd15de7652e77 100644 (file)
@@ -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;
 
index 557cfcbd2adcbbda7d10e392788c98003bea5a3b..998fc2d94df736f469da78ed047826c75bd1d605 100644 (file)
@@ -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 })"