fontconfig: Branch 'master'

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

 



 configure.ac |    1 +
 src/fcstat.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 8809d1b73b9c162ee0fecd314e2a80b287309954
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Thu Feb 26 14:08:20 2015 +0900

    Copy the real size of struct dirent
    
    In some platforms, d_name is defined as the flexible array member.
    We may need to compute the real size for that case.

diff --git a/configure.ac b/configure.ac
index 1e704cd..9141d3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -680,6 +680,7 @@ dnl Figure out what cache format suffix to use for this architecture
 AC_C_BIGENDIAN
 AC_CHECK_SIZEOF([void *])
 AC_CHECK_ALIGNOF([double])
+AC_CHECK_ALIGNOF([void *])
 
 dnl include the header file for workaround of miscalculating size on autoconf
 dnl particularly for fat binaries
diff --git a/src/fcstat.c b/src/fcstat.c
index 47b5884..d2eb258 100644
--- a/src/fcstat.c
+++ b/src/fcstat.c
@@ -215,8 +215,15 @@ FcScandir (const char		*dirp,
     {
 	if (!filter || (filter) (dent))
 	{
-	    p = (struct dirent *) malloc (sizeof (struct dirent));
-	    memcpy (p, dent, sizeof (struct dirent));
+	    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));
+	    }
+	    p = (struct dirent *) malloc (dentlen);
+	    memcpy (p, dent, dentlen);
 	    if (n >= lsize)
 	    {
 		lsize += 128;
_______________________________________________
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