summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-03-02 10:51:51 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-09 18:59:51 -0700
commite56a2ada719c5cfac5ed61a52a80ade86c0f5957 (patch)
tree8786afe5d6ae536aaff1df89b31f21419449b83e
parent06c086e8a1d8374ea9a95ff989f053c96bb1bdca (diff)
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>
-rw-r--r--src/xkb/XKBGetMap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xkb/XKBGetMap.c b/src/xkb/XKBGetMap.c
index af93a5cb..a68455bd 100644
--- a/src/xkb/XKBGetMap.c
+++ b/src/xkb/XKBGetMap.c
@@ -390,6 +390,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;
@@ -402,6 +405,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];
}
}