xserver-multidpi/xkb
Peter Hutterer f85552aa45 xkb: fix invalid memory writes in _XkbCopyGeom.
Classic strlen/strcpy mistake of
   foo = malloc(strlen(bar));
   strcpy(foo, bar);

Testcase: valgrind Xephyr :1

==8591== Invalid write of size 1
==8591==    at 0x4A0638F: strcpy (mc_replace_strmem.c:311)
==8591==    by 0x605593: _XkbCopyGeom (xkbUtils.c:1994)
==8591==    by 0x605973: XkbCopyKeymap (xkbUtils.c:2118)
==8591==    by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560)
==8591==    by 0x4472E2: CoreKeyboardProc (devices.c:577)
==8591==    by 0x447162: ActivateDevice (devices.c:530)
==8591==    by 0x4475D6: InitCoreDevices (devices.c:672)
==8591==    by 0x4449EE: main (main.c:254)
==8591==  Address 0x6f96505 is 0 bytes after a block of size 53 alloc'd
==8591==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==8591==    by 0x6054B7: _XkbCopyGeom (xkbUtils.c:1980)
==8591==    by 0x605973: XkbCopyKeymap (xkbUtils.c:2118)
==8591==    by 0x6122B3: InitKeyboardDeviceStruct (xkbInit.c:560)
==8591==    by 0x4472E2: CoreKeyboardProc (devices.c:577)
==8591==    by 0x447162: ActivateDevice (devices.c:530)
==8591==    by 0x4475D6: InitCoreDevices (devices.c:672)
==8591==    by 0x4449EE: main (main.c:254)

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by-and-apologised-for: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 7f19a7a6e9)

Conflicts:

	xkb/xkbUtils.c
2010-06-11 11:09:46 +10:00
..
Makefile.am xkb: don't conditionally include xkb-config.h. 2009-10-20 13:32:14 +10:00
README.compiled R6.6 is the Xorg base-line 2003-11-14 15:54:54 +00:00
XKBAlloc.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
XKBGAlloc.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
XKBMAlloc.c xkb: remove _XkbTyped*alloc 2010-01-25 09:24:31 +13:00
XKBMisc.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
XKM_file_format.txt xkb: Add XKM file format description. 2010-02-02 10:03:21 +10:00
ddxBeep.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
ddxCtrls.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxDevBtn.c xkb: purge unneeded includes from ddxDevBtn.c 2010-04-21 10:51:31 +10:00
ddxFakeMtn.c xkb: use GPE for XKB fake motion events. 2010-04-21 10:51:28 +10:00
ddxKillSrv.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxLEDs.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxList.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
ddxLoad.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
ddxPrivate.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
ddxVT.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
maprules.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkb.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkb.h xkb: move XkbFilterEvents to xkbsrv.h 2009-07-30 08:43:14 +10:00
xkbAccessX.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbActions.c xkb: use GPE for XKB fake motion events. 2010-04-21 10:51:28 +10:00
xkbDflts.h Static markup and dead code cull over xkb/. 2007-03-20 18:37:02 -04:00
xkbEvents.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbInit.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbLEDs.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbPrKeyEv.c input: don't use typecasts to access members of InternalEvent. 2009-09-22 11:15:32 +10:00
xkbSwap.c Remove #define NEED_EVENTS and NEED_REPLIES 2008-12-12 11:43:32 +10:00
xkbUtils.c xkb: fix invalid memory writes in _XkbCopyGeom. 2010-06-11 11:09:46 +10:00
xkbfmisc.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbgeom.h xkb: remove some now-useless XFUNCPROTOBEGIN 2009-05-08 14:28:44 +10:00
xkbout.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkbtext.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00
xkmread.c xkb: sed True -> TRUE and False -> FALSE 2010-02-02 10:03:30 +10:00

README.compiled

The X server uses this directory to store the compiled version of the
current keymap and/or any scratch keymaps used by clients.  The X server
or some other tool might destroy or replace the files in this directory,
so it is not a safe place to store compiled keymaps for long periods of
time.  The default keymap for any server is usually stored in:
     X<num>-default.xkm
where <num> is the display number of the server in question, which makes
it possible for several servers *on the same host* to share the same 
directory.

Unless the X server is modified, sharing this directory between servers on
different hosts could cause problems.