[PATCH 11/15] xkb: Fix possible NULL pointer dereference

Pauli Nieminen ext-pauli.nieminen at nokia.com
Tue Jul 27 05:09:52 PDT 2010


sli is null beofre allocation assigment so deference t osli has to be
protected.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 xkb/xkbLEDs.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 1682671..515e9b7 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -556,6 +556,7 @@ Bool			checkNames;
     else if ((kf!=NULL)&&((kf->xkb_sli->flags&XkbSLI_IsDefault)!=0)) {
 	XkbDescPtr	xkb;
 	xkb= dev->key->xkbInfo->desc;
+	sli= kf->xkb_sli;
 	sli->physIndicators=	xkb->indicators->phys_indicators;
 	if (xkb->names->indicators!=sli->names) {
 	    checkNames= TRUE;
@@ -584,6 +585,8 @@ Bool			checkNames;
 	sli->maps=		NULL;
 	sli->names=		NULL;
     }
+    else
+	return NULL;
     if ((sli->names==NULL)&&(needed_parts&XkbXI_IndicatorNamesMask))
 	sli->names= calloc(XkbNumIndicators, sizeof(Atom));
     if ((sli->maps==NULL)&&(needed_parts&XkbXI_IndicatorMapsMask))
-- 
1.6.3.3



More information about the xorg-devel mailing list