[PATCH] [xkb] Fix possible NULL dereference in XkbFlushLedEvents()
Ian Romanick
idr at freedesktop.org
Thu Dec 17 10:56:12 PST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tomas Carnecky wrote:
> Through some code paths it is possible that NULL is being passed in the
> 'ed' parameter to XkbFlushLedEvents(). Make sure we don't pass it along
> to bzero().
>
> Signed-off-by: Tomas Carnecky <tom at dbservice.com>
> ---
> xkb/xkbLEDs.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
> index 59cdba4..dfdd5a2 100644
> --- a/xkb/xkbLEDs.c
> +++ b/xkb/xkbLEDs.c
> @@ -750,7 +750,8 @@ XkbFlushLedEvents( DeviceIntPtr dev,
> XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState);
> XkbSendExtensionDeviceNotify(dev,cause->client,ed);
> }
> - bzero((char *)ed,sizeof(XkbExtensionDeviceNotify));
> + if (ed)
> + bzero((char *)ed,sizeof(XkbExtensionDeviceNotify));
Since the preceding if-statement is "if (ed && (ed->reason))", I think
it would be more clear to restructure the code as:
if (ed) {
if (ed->reason)) {
if ((dev!=kbd)&&(ed->reason&XkbXI_IndicatorStateMask))
XkbDDXUpdateDeviceIndicators(dev,sli,sli->effectiveState);
XkbSendExtensionDeviceNotify(dev,cause->client,ed);
}
bzero((char *)ed,sizeof(XkbExtensionDeviceNotify));
}
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> return;
> }
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAksqfssACgkQX1gOwKyEAw8WAACdEfWfUrVNnIKwCjDJzwrcyHVB
xA8AnR6eJ6nbHGEgeodaVdtLX+5AIa4d
=NlaA
-----END PGP SIGNATURE-----
More information about the xorg-devel
mailing list