aboutsummaryrefslogtreecommitdiff
path: root/cmd-parse.y
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-05-26 08:42:55 +0100
committerThomas Adam <thomas@xteddy.org>2020-05-26 08:42:55 +0100
commit967e5f8be3d89c6b604484d3b7b2a1ff25db06a5 (patch)
treeabdf31d46ae31d0bf7b705454e7bf86ccebc06b9 /cmd-parse.y
parentfd4d3e87938206d8d05509162c3f3a3c274bb478 (diff)
parent6f03e49e68dfe0d9c0c7d49079c4383b26aca916 (diff)
downloadrtmux-967e5f8be3d89c6b604484d3b7b2a1ff25db06a5.tar.gz
rtmux-967e5f8be3d89c6b604484d3b7b2a1ff25db06a5.tar.bz2
rtmux-967e5f8be3d89c6b604484d3b7b2a1ff25db06a5.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-parse.y')
-rw-r--r--cmd-parse.y13
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd-parse.y b/cmd-parse.y
index 891f2289..9f36af7e 100644
--- a/cmd-parse.y
+++ b/cmd-parse.y
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <wchar.h>
#include "tmux.h"
@@ -1251,10 +1252,9 @@ error:
static int
yylex_token_escape(char **buf, size_t *len)
{
- int ch, type, o2, o3;
- u_int size, i, tmp;
- char s[9];
- struct utf8_data ud;
+ int ch, type, o2, o3, mlen;
+ u_int size, i, tmp;
+ char s[9], m[MB_LEN_MAX];
ch = yylex_getc();
@@ -1339,11 +1339,12 @@ unicode:
yyerror("invalid \\%c argument", type);
return (0);
}
- if (utf8_split(tmp, &ud) != UTF8_DONE) {
+ mlen = wctomb(m, tmp);
+ if (mlen <= 0 || mlen > (int)sizeof m) {
yyerror("invalid \\%c argument", type);
return (0);
}
- yylex_append(buf, len, ud.data, ud.size);
+ yylex_append(buf, len, m, mlen);
return (1);
}