diff options
author | nicm <nicm> | 2016-04-25 17:05:53 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-04-25 17:05:53 +0000 |
commit | 6bf2a43e675c9c1d2cd9b13f326f010e7fba727d (patch) | |
tree | f824f5b8bd15ae128f14763e1a49d5293b97ce5e /key-string.c | |
parent | 075c086d29cbf22397ba2dda4b43db7e7df31781 (diff) | |
download | rtmux-6bf2a43e675c9c1d2cd9b13f326f010e7fba727d.tar.gz rtmux-6bf2a43e675c9c1d2cd9b13f326f010e7fba727d.tar.bz2 rtmux-6bf2a43e675c9c1d2cd9b13f326f010e7fba727d.zip |
Don't overwrite modifiers in the buffer when making UTF-8 strings,
append instead.
Diffstat (limited to 'key-string.c')
-rw-r--r-- | key-string.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/key-string.c b/key-string.c index 119035a0..bbbe346c 100644 --- a/key-string.c +++ b/key-string.c @@ -226,6 +226,7 @@ key_string_lookup_key(key_code key) char tmp[8]; u_int i; struct utf8_data ud; + size_t off; *out = '\0'; @@ -270,8 +271,9 @@ key_string_lookup_key(key_code key) /* Is this a UTF-8 key? */ if (key > 127 && key < KEYC_BASE) { if (utf8_split(key, &ud) == UTF8_DONE) { - memcpy(out, ud.data, ud.size); - out[ud.size] = '\0'; + off = strlen(out); + memcpy(out + off, ud.data, ud.size); + out[off + ud.size] = '\0'; return (out); } } |