[PATCH] xfree86: fix VbeModeInfoBlock memcpy off-by-one (#30159)

Jeremy Huddleston jeremyhu at apple.com
Wed Oct 13 16:20:58 PDT 2010


This patch seems to have wandered into the void... what is its state?


On Sep 30, 2010, at 14:47, Rémi Cardona wrote:

> Le 28/09/2010 17:16, Adam Jackson a écrit :
>> It's correct but it's exactly as ridiculous as the original.  How's this
>> instead:
> 
> ♥ !
> 
> Although...
> 
>> --- a/hw/xfree86/vbe/vbe.c
>> +++ b/hw/xfree86/vbe/vbe.c
>> @@ -529,67 +529,7 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode)
>> 
>>     block = calloc(sizeof(VbeModeInfoBlock), 1);
> 
> ... maybe this one can become a regular malloc(), since the structure is
> packed and the copy covers the entire struct, there won't be any
> uninitialized holes.
> 
> [...]
> 
>> +    memcpy(block, pVbe->memory, 256);
> 
> Just wondering, why not use sizeof here as well? Am I missing something?
> 
> In any case, the new patch makes a whole lot more sense than the old
> code, I still can't believe it was that simple. I'll gladly update your
> patch if needs be.
> 
> Reviewed-by: Rémi Cardona <remi at gentoo.org>
> 
> Cheers
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel



More information about the xorg-devel mailing list