summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2003-11-02 06:10:14 +0000
committersabetts <sabetts>2003-11-02 06:10:14 +0000
commitcafd2e3f092ee5d694520c31cfbd33abcf1af843 (patch)
tree21387806e7007accbdd8cf40f12c68c9231311e7 /src
parenta935e0fc83202fd34d27105fda7e9f4a4ea434c3 (diff)
downloadratpoison-cafd2e3f092ee5d694520c31cfbd33abcf1af843.zip
(cook_keycode): null terminate the string.
Diffstat (limited to 'src')
-rw-r--r--src/input.c6
1 files changed, 6 insertions, 0 deletions
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