symbols: fix buffer overflow with illegal explicit group
authorRan Benita <ran234@gmail.com>
Mon, 17 Sep 2012 11:24:38 +0000 (14:24 +0300)
committerRan Benita <ran234@gmail.com>
Mon, 17 Sep 2012 11:30:16 +0000 (14:30 +0300)
commitac872bdfc286e9464a04b77c724829dd206e11a7
tree49b992042f02983d32d2922e9a5500c62c2a2070
parentdbd7a95359652032466cadad8d8749c9ed1bfbfa
symbols: fix buffer overflow with illegal explicit group

Trying ''./test/interactive -l us:5' causes us to crash.

The <layout>:<N> syntax says to put this layout at the N'th level.
However the code (inherited from xkbcomp) doesn't check that the group
is valid, and then happily indexes keyi->groups with it, which has a
static size of XKB_NUM_GROUPS (the SetExplicitGroup function assumes the
index is valid). So any value a user might put there > 4 makes nice
things happen.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/symbols.c
test/rulescomp.c