[Fontconfig] fontconfig: Branch 'master'

Raimund Steger rs at mytum.de
Mon Mar 2 14:27:11 PST 2015


Hi,

I think there is still a problem.


On 02/23/15 07:23, Akira TAGOH wrote:
> [...]
>   src/fcstat.c |   80 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
> [...]
> +int
> +FcScandir (const char		*dirp,
> +	   struct dirent	***namelist,
> +	   int (*filter) (const struct dirent *),
> +	   int (*compar) (const struct dirent **, const struct dirent **))

in the while loop in FcScandir, if n==lsize-1 -- it won't yet enter the 
'if' branch:

> [...]
> +	    if (n >= lsize)
> +	    {
> +		lsize += 128;
> +		dlp = (struct dirent **) realloc (dlist, sizeof (struct dirent *) * lsize);

then this will effectively be dlist[lsize], thus unallocated:

> [...]
> +	    }
> +	    dlist[n++] = p;
> +	    dlist[n] = NULL;

I think.
maybe "if (n >= lsize-1)" would be better?

Raimund



-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>


More information about the Fontconfig mailing list