fontconfig: Branch 'master'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 src/fcstat.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 97cf7ec4d740c9b3ac7c29388224f5e0c226a120
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Fri Feb 27 12:04:44 2015 +0900

    Rework again to copy the struct dirent
    
    Assuming that d_name is the last member of struct dirent.
    In POSIX, the maximum length of d_name is defined as NAME_MAX
    or FILENAME_MAX though, that assumption may be wrong on some
    platforms where defines d_name as the flexible array member
    and allocate the minimum memory to store d_name.
    
    Patch from Raimund Steger

diff --git a/src/fcstat.c b/src/fcstat.c
index d2eb258..d444bf9 100644
--- a/src/fcstat.c
+++ b/src/fcstat.c
@@ -215,13 +215,8 @@ FcScandir (const char		*dirp,
     {
 	if (!filter || (filter) (dent))
 	{
-	    size_t dentlen = sizeof (struct dirent);
-
-	    if (sizeof (struct dirent) == FcPtrToOffset (dent, dent->d_name))
-	    {
-		dentlen += strlen (dent->d_name) + 1;
-		dentlen = ((dentlen + ALIGNOF_VOID_P - 1) & ~(ALIGNOF_VOID_P - 1));
-	    }
+	    size_t dentlen = FcPtrToOffset (dent, dent->d_name) + strlen (dent->d_name) + 1;
+	    dentlen = ((dentlen + ALIGNOF_VOID_P - 1) & ~(ALIGNOF_VOID_P - 1));
 	    p = (struct dirent *) malloc (dentlen);
 	    memcpy (p, dent, dentlen);
 	    if (n >= lsize)
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig





[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux