From cafd2e3f092ee5d694520c31cfbd33abcf1af843 Mon Sep 17 00:00:00 2001 From: sabetts Date: Sun, 2 Nov 2003 06:10:14 +0000 Subject: (cook_keycode): null terminate the string. --- src/input.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/input.c b/src/input.c index b069991..ab52931 100644 --- a/src/input.c +++ b/src/input.c @@ -242,8 +242,14 @@ cook_keycode (XKeyEvent *ev, KeySym *keysym, unsigned int *mod, char *keysym_nam | rp_modifier_info.scroll_lock_mask); } + if (len > 0) len--; nbytes = XLookupString (ev, keysym_name, len, keysym, NULL); + /* Null terminate the string (not all X servers do it for us). */ + if (keysym_name) { + keysym_name[nbytes] = '\0'; + } + *mod = ev->state; *mod &= (rp_modifier_info.meta_mod_mask | rp_modifier_info.alt_mod_mask -- cgit v1.2.3