aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/XKBGetMap.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-03-02 10:51:51 -0800
committerUlrich Sibiller <uli42@gmx.de>2016-10-12 09:34:39 +0200
commit7564bf7efc93b87da7a512a0ba205c9d1d26ff36 (patch)
tree60824ee1b9b60b80bc1afa12bd0e507158215425 /nx-X11/lib/X11/XKBGetMap.c
parent8f2c050828c3f8b2574f720625ee6ee7041f3d36 (diff)
downloadnx-libs-7564bf7efc93b87da7a512a0ba205c9d1d26ff36.tar.gz
nx-libs-7564bf7efc93b87da7a512a0ba205c9d1d26ff36.tar.bz2
nx-libs-7564bf7efc93b87da7a512a0ba205c9d1d26ff36.zip
unvalidated index in _XkbReadModifierMap() [CVE-2013-1997 8/15]
If the X server returns modifier map indexes outside the range of the number of keys it told us to allocate, out of bounds memory writes could occur. Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr> Signed-off-by: Julien Cristau <jcristau@debian.org> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/XKBGetMap.c')
-rw-r--r--nx-X11/lib/X11/XKBGetMap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/nx-X11/lib/X11/XKBGetMap.c b/nx-X11/lib/X11/XKBGetMap.c
index 79fa315cd..56f068dbf 100644
--- a/nx-X11/lib/X11/XKBGetMap.c
+++ b/nx-X11/lib/X11/XKBGetMap.c
@@ -391,6 +391,9 @@ register int i;
unsigned char *wire;
if ( rep->totalModMapKeys>0 ) {
+ if ( ((int)rep->firstModMapKey + rep->nModMapKeys) >
+ (xkb->max_key_code + 1))
+ return BadLength;
if ((xkb->map->modmap==NULL)&&
(XkbAllocClientMap(xkb,XkbModifierMapMask,0)!=Success)) {
return BadAlloc;
@@ -403,6 +406,8 @@ unsigned char *wire;
if (!wire)
return BadLength;
for (i=0;i<rep->totalModMapKeys;i++,wire+=2) {
+ if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code)
+ return BadLength;
xkb->map->modmap[wire[0]]= wire[1];
}
}