[PATCH:libICE 2/2] IceWritePad: Zero fill pad bytes used when buffer is full

Jeremy Huddleston jeremyhu at apple.com
Tue Apr 19 18:49:46 PDT 2011


Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Apr 19, 2011, at 18:40, Alan Coopersmith wrote:

> Should be rarely hit, since it's only in the case where most of the
> message fits in the buffer, but there's not room left for the padding
> bytes, but better than sending uninitialized bytes off the stack when
> it happens.
> 
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> include/X11/ICE/ICEmsg.h |    6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/X11/ICE/ICEmsg.h b/include/X11/ICE/ICEmsg.h
> index 6a60f1c..8ca3e5f 100644
> --- a/include/X11/ICE/ICEmsg.h
> +++ b/include/X11/ICE/ICEmsg.h
> @@ -217,15 +217,15 @@ extern IcePaAuthStatus _IcePaMagicCookie1Proc (
> 
> /*
>  * Write pad bytes.  Used to force 32 or 64 bit alignment.
> - * A maxium of 7 pad bytes can be specified.
> + * A maximum of 7 pad bytes can be specified.
>  */
> 
> #define IceWritePad(_iceConn, _bytes) \
> { \
>     if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
>     { \
> -        char _dummy[7]; \
> -	IceFlush (_iceConn); \
> +        char _dummy[7] = { 0 }; \
> +        IceFlush (_iceConn); \
>         _IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \
>     } \
>     else \
> -- 
> 1.7.3.2
> 
> _______________________________________________
> 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