[PATCH] xfree86: fix VbeModeInfoBlock memcpy off-by-one (#30159)
Rémi Cardona
remi at gentoo.org
Thu Sep 30 14:47:52 PDT 2010
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
More information about the xorg-devel
mailing list