summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/input.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b611f43..18ec8c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-11-01 Shawn Betts <sabetts@vcn.bc.ca>
+
+ * src/input.c (cook_keycode): null terminate the string.
+
2003-10-24 Ryan Yeske <rcyeske@vcn.bc.ca>
* contrib/ratpoison.el: Added requires.
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