aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwalter harms <wharms@bfs.de>2014-06-04 17:10:20 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:29 +0200
commit861fe5aee1519244e4af04007076dbd814ed2b0b (patch)
tree0b368a2fd4abbdf08859fa51b67fb5499137681d
parente7528f5816a3196c9869c6028f012ae0a6b3d650 (diff)
downloadnx-libs-861fe5aee1519244e4af04007076dbd814ed2b0b.tar.gz
nx-libs-861fe5aee1519244e4af04007076dbd814ed2b0b.tar.bz2
nx-libs-861fe5aee1519244e4af04007076dbd814ed2b0b.zip
libX11/XKBNames.c fix: dereferenced before check
* Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
-rw-r--r--nx-X11/lib/X11/XKBNames.c9
1 files 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);