[PATCH libXfont] Fix buffer read overrun

Alan Coopersmith alan.coopersmith at oracle.com
Mon Apr 7 14:21:06 PDT 2014


On 04/ 7/14 01:25 PM, walter harms wrote:
>
>
> Am 07.04.2014 20:29, schrieb Peter Harris:
>> "FreeType" is only eight bytes long. The atom "FreeType\x00\x??" is
>> probably not what the author intended.
>>
>> Signed-off-by: Peter Harris <pharris at opentext.com>
>> ---
>>   src/FreeType/ftfuncs.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
>> index 65efefc..a4969d1 100644
>> --- a/src/FreeType/ftfuncs.c
>> +++ b/src/FreeType/ftfuncs.c
>> @@ -1867,7 +1867,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
>>       i++;
>>
>>       info->props[i].name  = MakeAtom("RASTERIZER_NAME", 15, TRUE);
>> -    info->props[i].value = MakeAtom("FreeType", 10, TRUE);
>> +    info->props[i].value = MakeAtom("FreeType", 8, TRUE);
>>       info->isStringProp[i] = 1;
>>       i++;
>>
>
> Since i am not a big fan of magic numbers ...
> MakeAtom("FreeType", strlen("FreeType"), TRUE);
>
> maybe there is macro for that ?

There are several in various C files in the Xserver, but none that made it
into a shared header:

glamor/glamor_xv.c:#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
hw/kdrive/src/kinput.c:#define AtomFromName(x) MakeAtom(x, strlen(x), 1)
xkb/ddxBeep.c:#define   MAKE_ATOM(a)    MakeAtom(a,sizeof(a)-1,TRUE)
xkb/xkbDflts.h:#define GET_ATOM(d,s)    MakeAtom(s,strlen(s),1)
xkb/xkbInit.c:#define   CREATE_ATOM(s)  MakeAtom(s,sizeof(s)-1,1)

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list