diff options
author | 2016-04-25 17:05:53 +0000 | |
---|---|---|
committer | 2016-04-25 17:05:53 +0000 | |
commit | 2e21ac3a64a2f8ccafc89bd84391df3731f85a5c (patch) | |
tree | 5c06afceb7bafb42eb2a372ef8d47cbf9c9a026e /usr.bin/tmux/key-string.c | |
parent | use setresgid() rather than setegid, all 3 gids can go the same way. (diff) | |
download | wireguard-openbsd-2e21ac3a64a2f8ccafc89bd84391df3731f85a5c.tar.xz wireguard-openbsd-2e21ac3a64a2f8ccafc89bd84391df3731f85a5c.zip |
Don't overwrite modifiers in the buffer when making UTF-8 strings,
append instead.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 6124e53ce4f..e5a16e6b424 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.36 2016/03/18 07:28:27 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.37 2016/04/25 17:05:53 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); } } |