From 861fe5aee1519244e4af04007076dbd814ed2b0b Mon Sep 17 00:00:00 2001 From: walter harms Date: Wed, 4 Jun 2014 17:10:20 +0200 Subject: libX11/XKBNames.c fix: dereferenced before check * Do not use variables before checked for NULL. Signed-off-by: Harms Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/XKBNames.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nx-X11/lib/X11/XKBNames.c b/nx-X11/lib/X11/XKBNames.c index 3cfd02f96..f5a6ed1fa 100644 --- a/nx-X11/lib/X11/XKBNames.c +++ b/nx-X11/lib/X11/XKBNames.c @@ -778,9 +778,14 @@ XkbNoteNameChanges(XkbNameChangesPtr old, { int first, last, old_last, new_last; - wanted &= new->changed; - if ((old == NULL) || (new == NULL) || (wanted == 0)) + if ((old == NULL) || (new == NULL)) return; + + wanted &= new->changed; + + if (wanted == 0) + return; + if (wanted & XkbKeyTypeNamesMask) { if (old->changed & XkbKeyTypeNamesMask) { new_last = (new->first_type + new->num_types - 1); -- cgit v1.2.3