summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-11-28 14:55:15 +1000
committerPeter Hutterer <peter.hutterer@redhat.com>2008-12-02 15:50:38 +1000
commit95fc59a199f99bf167fbb09297a9bb0e33e31869 (patch)
treeddb9d601d3022005dacf7563360c4827f54540a7 /xkb
parenta425abf0eaa61ee5ccb2f32a1af24edd190f7889 (diff)
xkb: Extra sanity checks to prevent dev->key == NULL dereferencing.
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkbEvents.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index c06b852fe..8b30d1160 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -110,7 +110,7 @@ Time time;
register CARD16 changed,bState;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
state= &xkbi->state;
@@ -169,6 +169,9 @@ XkbSrvInfoPtr xkbi;
unsigned time = 0,initialized;
CARD16 changed;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
initialized= 0;
@@ -292,7 +295,7 @@ XkbInterestPtr interest;
Time time = 0;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
@@ -402,6 +405,9 @@ CARD16 pitch,duration;
Time time = 0;
XID winID = 0;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&&
@@ -617,11 +623,12 @@ XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
Time time = 0;
- xkbi = kbd->key->xkbInfo;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
+ xkbi = kbd->key->xkbInfo;
+
initialized = 0;
pEv->mods= xkbi->state.mods;
pEv->group= xkbi->state.group;
@@ -1016,6 +1023,10 @@ unsigned long autoCtrls,autoValues;
ClientPtr client = NULL;
found= False;
+
+ if (!dev->key || !dev->key->xkbInfo)
+ return found;
+
autoCtrls= autoValues= 0;
if ( dev->xkb_interest ) {
interest = dev->xkb_interest;