[PATCH xserver 3/5] randr: ProcRRGetOutputInfo: initialize memory

Eric Engestrom eric.engestrom at imgtec.com
Mon Nov 6 16:17:12 UTC 2017


On Saturday, 2017-11-04 23:06:29 +0100, Giuseppe Bilotta wrote:
> Running Xephyr under valgrind reveals that we're sending some
> uninitialized memory over the wire (particularly, the leftover padding
> that comes from rounding extraLen to the next 32-bit multiple).
> 
> Solve by calloc()ing the memory instead of malloc()ing (the alternative
> would be to memset just the padding, but I'm not sure it's more
> convenient.)

This sounds like the right fix, but I don't know enough to be sure.

The rest of the series is
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
> ---
>  randr/rroutput.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/randr/rroutput.c b/randr/rroutput.c
> index a8efec409..647f19a52 100644
> --- a/randr/rroutput.c
> +++ b/randr/rroutput.c
> @@ -459,7 +459,7 @@ ProcRRGetOutputInfo(ClientPtr client)
>  
>      if (extraLen) {
>          rep.length += bytes_to_int32(extraLen);
> -        extra = malloc(extraLen);
> +        extra = calloc(1, extraLen);
>          if (!extra)
>              return BadAlloc;
>      }
> -- 
> 2.14.1.439.g647b9b4702
> 


More information about the xorg-devel mailing list